探索,發現,愛好、學習,記錄,分享。
學海無涯,天涯若比鄰,三人行,必有我師。

Xenforo Nginx Apache 靜態化

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>

 

版權聲明:本文采用知識共享 署名4.0國際許可協議 [BY-NC-SA] 進行授權
轉載事宜:如需轉載需徵得應允,轉載必須注明來源於本站的信息。
文章名称:《Xenforo Nginx Apache 靜態化》
文章链接:https://www.thefreesky.com/blog/26311.html
本站資源僅供個人學習交流,請於下載後24小時內刪除,不允許用於商業用途,否則法律問題自行承擔。

評論 抢沙发