1,pathInfo 路径
- 支持ThinkPHP pathInfo路径 注释include enable-php.conf; 添加include enable-php-pathinfo.conf;
- 'url_model'=> '1', //URL模式 即pathinfo cgi.fix_pathinfo=0 改成cgi.fix_pathinfo=1
- 设置访问文件夹列表,注释后怎为 403 forbidden
server
{
listen 8080;
#listen [::]:80;
server_name 139.196.137.253 ;
index index.html index.htm index.php default.html default.htm default.php;
root /home/wwwroot/www.freeenjoy.com;
include other.conf;
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
#支持ThinkPHP pathInfo路径 注释include enable-php.conf; 添加include enable-php-pathinfo.conf;
#include enable-php.conf;
include enable-php-pathinfo.conf;
#设置访问文件夹列表,注释后怎为 403 forbidden
location ~ /*
{
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ [^/]\.php(/|$)
{
#try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
include pathinfo.conf;
}
access_log /home/wwwlogs/www.freeenjoy.com.log;
}
2,隐藏端口号
server {
listen 80;
server_name www.up.com;
location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:1031;
}
}
proxy_set_header Host $proxy_host;
参考1