1server { 2 listen 80; 3 server_name _; 4 access_log /data/wwwlogs/access_nginx.log combined; 5 root /data/wwwroot/default; 6 index index.html index.htm index.php; 7 #error_page 404 /404.html; 8 #error_page 502 /502.html; 9 location /nginx_status { 10 stub_status on; 11 access_log off; 12 allow 127.0.0.1; 13 deny all; 14 } 15 16 location / { 17 # Redirect everything that isn't a real file to index.php单文件入口 18 try_files $uri $uri/ /index.php?_url=$uri&$args; 19 20 } 21 22 location ~ \.php$ { 23 #fastcgi_pass remote_php_ip:9000; 24 fastcgi_pass unix:/dev/shm/php-cgi.sock; 25 fastcgi_index index.php; 26 include fastcgi.conf; 27 fastcgi_split_path_info ^(.+\.php)(/.+)$; 28 #支持pathinfo 29 } 30 31 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ { 32 expires 30d; 33 access_log off; 34 } 35 location ~ .*\.(js|css)?$ { 36 expires 7d; 37 access_log off; 38 } 39 location ~ /\.ht { 40 deny all; 41 } 42 }
Nginx路由重写
Stella981
2021-10-11
1285 0 0
点赞
收藏
评论区
加载中...