location ~ \.php$ { try_files $uri =404; include /etc/nginx/fastcgi_params; fastcgi_pass unix:/run/php/php7.0-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } location /community/ { try_files $uri $uri/ /community/index.php?$uri&$args; }
location /forums/ { index index.php index.html index.htm; try_files $uri $uri/ /forums/index.php?$uri&$args; } location /forums/install/data/ { internal; } location /forums/install/templates/ { internal; } location /forums/internal_data/ { internal; } location /forums/library/ { internal; } # xenforo 2 uncomment / remove hash from next 3 lines #location /forums/src/ { #internal; #}
加密保護目錄
location /admin.php { auth_basic "Private"; auth_basic_user_file /usr/local/nginx/conf/htpasswd_admin_php; include /usr/local/nginx/conf/php.conf; allow 127.0.0.1; allow YOURIPADDRESS; deny all; }
推荐这条
location / { if (!-e $request_filename){ rewrite ^(.*)$ /index.php?s=$1 last; break; } } location ~ ^/(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt)/ { deny all; return 404; }
Apache
# Mod_security can interfere with uploading of content such as attachments. If you # cannot attach files, remove the "#" from the lines below. #<IfModule mod_security.c> # SecFilterEngine Off # SecFilterScanPOST Off #</IfModule> ErrorDocument 401 default ErrorDocument 403 default ErrorDocument 404 default ErrorDocument 405 default ErrorDocument 406 default ErrorDocument 500 default ErrorDocument 501 default ErrorDocument 503 default <IfModule mod_rewrite.c> RewriteEngine On # If you are having problems with the rewrite rules, remove the "#" from the # line that begins "RewriteBase" below. You will also have to change the path # of the rewrite to reflect the path to your XenForo installation. #RewriteBase /xenforo # This line may be needed to workaround HTTP Basic auth issues when using PHP as a CGI. #RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -l [OR] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^.*$ - [NC,L] RewriteRule ^(data/|js/|styles/|install/|favicon\.ico|crossdomain\.xml|robots\.txt) - [NC,L] RewriteRule ^.*$ index.php [NC,L] </IfModule>
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容