Apache静态网站权限配置
<VirtualHost *:80>
RewriteEngine On
RewriteCond %{HTTPS} =off
RewriteRule ^ https://%{SERVER_NAME}:2053%{REQUEST_URI} [L]
</VirtualHost>
<VirtualHost *:443>
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile "/root/ssl/joxqyd.feieryun.cn_bundle.crt"
SSLCertificateKeyFile "/root/ssl/joxqyd.feieryun.cn.key"
Protocols h2
Alias "/users" "/users"
<Directory />
DirectoryIndex index.php
AllowOverride FileInfo
<Files ~ ".+">
Deny from all
Require all denied
</Files>
<Files ~ ".php$">
Allow from all
</Files>
<Files ~ ".(html|htm|css|js|ttf|woff|ico|gif)">
Allow from all
</Files>
</Directory>
<Directory "/users">
AllowOverride AuthConfig Indexes FileInfo
php_admin_flag engine off
Options Indexes
IndexOptions FancyIndexing HTMLTable
IndexOptions IgnoreCase
IndexStyleSheet "/users/xixi/public/css/index.css"
AuthType Basic
AuthName "Restricted Area"
AuthUserFile "/users/.htpasswd"
<Files ~ ".+">
Deny from all
Require all denied
</Files>
<Files ~ "index\.html$">
Allow from all
</Files>
<Files ~ ".(html|htm|css|js|ttf|woff|ico)">
Allow from all
</Files>
<Files ~ ".(zip|rar|7z|mp3|jpg|png)$">
Allow from all
</Files>
</Directory>
</VirtualHost>
/users/xixi/public/css/index.css
/* custom-style.css */
table {
border-collapse: collapse;
width: 100%;
border: 1px solid #ddd; /* 添加细边框 */
}
th, td {
border: 1px solid #ddd; /* 添加细边框 */
padding: 8px;
text-align: center;
}
.indexbreakrow {
display: none;
}
.indexcolname {
text-align: left;
}
必须在需要共享的文件夹中放上
.htaccess
DirectoryIndex
Require all granted
IndexIgnore *.htm *.html *.css
<Files ~ ".(html|htm|css|zip|rar|7z|mp3|jpg|png)$">
Require all granted
</Files>
IndexIgnore "css"
AddDescription "纸飞机聊天软件" "tportable*"
AddDescription "WindowsFQ软件" "sing-box*"
AddDescription "ZIP压缩包" "*.zip"
AddDescription "7Z压缩包" "*.7z"
AddDescription "图片文件" "*.png"
AddDescription "MP3音乐" "mp3"
AddDescription "软件包" "software"
本文来自博客园,作者:项希盛,转载请注明原文链接:https://www.cnblogs.com/xiangxisheng/p/17932274.html
浙公网安备 33010602011771号