nginx配置文件

逃离我推掉我的手 2022-03-27 11:28 366阅读 0赞

sockstat 查看所有端口

server
{
listen 80;
server_name www.bghome.com;
index index.php index.html index.htm;
root /data/www/bighome/myhome/www;
autoindex on;
large_client_header_buffers 4 16k;
client_max_body_size 300m;
client_body_buffer_size 128k;
proxy_connect_timeout 600;
proxy_read_timeout 600;
proxy_send_timeout 600;
proxy_buffer_size 64k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;

  1. proxy\_set\_header Host $host;
  2. proxy\_set\_header X-Real-IP $remote\_addr;
  3. proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;
  4. if ($host = 'bghome.com' ) \{
  5. rewrite ^/(.\*)$ http://www.bghome.com/$1 permanent;
  6. \}
  7. location = /favicon.ico \{
  8. root /data/www/bighome/myhome/www;
  9. \}
  10. \# Deny all attempts to access hidden files such as .htaccess, .htpasswd,.DS\_Store(Mac).
  11. location ~ /\\. \{
  12. deny all;
  13. \}
  14. location ~\* /(?:uploads|files)/.\*\\.php$ \{
  15. deny all;
  16. \}
  17. location / \{
  18. try\_files $uri $uri/ /index.php?$args;
  19. proxy\_pass http://127.0.0.1:9000;
  20. proxy\_read\_timeout 300;
  21. proxy\_set\_header Host $host;
  22. proxy\_set\_header X-Real-IP $remote\_addr;
  23. proxy\_set\_header X-Forwarded-For $proxy\_add\_x\_forwarded\_for;
  24. \}
  25. location ~\* ^.+\\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ \{
  26. access\_log off;
  27. log\_not\_found off;
  28. expires max;
  29. \}
  30. location ~\* \\.(js|css|png|jpg|jpeg|gif|ico)$ \{
  31. expires 24h;
  32. log\_not\_found off;
  33. \}
  34. error\_page 404 /404.html;
  35. error\_page 500 502 503 504 /50x.html;
  36. location = /50x.html \{
  37. root /usr/share/nginx/html;
  38. \}
  39. location ~\* \\.(eot|otf|ttf|woff)$ \{
  40. add\_header Access-Control-Allow-Origin \*;
  41. \}
  42. location ~ \\.php
  43. \{
  44. fastcgi\_index index.php;
  45. fastcgi\_pass 127.0.0.1:9000;
  46. \#fastcgi\_pass unix:/var/run/php-fpm/php-fpm55.sock;
  47. include fastcgi\_params;
  48. set $path\_info "";
  49. set $real\_script\_name $fastcgi\_script\_name;
  50. if ($fastcgi\_script\_name ~ "^(.+?\\.php)(/.+)$") \{
  51. set $real\_script\_name $1;
  52. set $path\_info $2;
  53. \}
  54. fastcgi\_param SCRIPT\_FILENAME $document\_root$real\_script\_name;
  55. fastcgi\_param SCRIPT\_NAME $real\_script\_name;
  56. fastcgi\_param PATH\_INFO $path\_info;

}

#location ~ ^(.+\.php)(.*)$
#{
# fastcgi_split_path_info ^(.+\.php)(/.+)$;
# fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# fastcgi_param PATH_INFO $fastcgi_path_info;
# fastcgi_index index.php;
# fastcgi_pass 127.0.0.1:9000;
# #fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
# include fastcgi_params;
#}
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root /var/www;
#}
#include location.conf;
}

发表评论

表情:
评论列表 (有 0 条评论,366人围观)

还没有评论,来说两句吧...

相关阅读

    相关 nginx 配置文件配置

    nginx 分为三个模块 核心模块 : nginx最基本最核心的服务,例如 进程管理,权限控制,日志记录 http模块 第三方模块   nginx配置文件实例

    相关 Nginx配置文件

    Nginx配置文件 一、组成部分 1. main:全局设置 2. server:主机设置 3. upstream:上游服务器设置【反向代理、负载均衡】 4.