9169yy_app.con f 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. server {
  2. listen 80;
  3. server_name x9169e.xyz;
  4. root /web/online/x9169e_xyz;
  5. index index.html index.htm;
  6. # 重定向到HTTPS并带"www"的域名
  7. if ($host != "x9169e.xyz") {
  8. return 301 https://x9169e.xyz$request_uri;
  9. }
  10. location / {
  11. root /web/online/x9169e_xyz;
  12. index index.php index.html index.htm;
  13. if (!-e $request_filename) {
  14. rewrite ^(.*)$ /index.php/$1 last; #注(目的是将/后面的路径前加上index.php)
  15. }
  16. }
  17. location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css|html)$ {
  18. #禁止缓存,每次都从服务器请求
  19. expires 1d;
  20. }
  21. location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css|html)$ {
  22. #禁止缓存,每次都从服务器请求
  23. expires 1d;
  24. }
  25. location ~ \.php$ {
  26. root /web/online/x9169e_xyz;
  27. fastcgi_split_path_info ^(.+\.php)(.*)$;
  28. fastcgi_pass 127.0.0.1:9000;
  29. #包含nginx服务器传递给fastcgi程序的参数,php中通过$_SERVER['参数名']可获取
  30. include fastcgi.conf;
  31. set $path_info "";
  32. set $fastcgi_script_name_new $fastcgi_script_name;
  33. #判断url是否是pathinfo形式的,如果是则把这个url分割成两部分,index.php入口文件之后的pathinfo部分存入$path_info变量中,剩下的部分和$document_root根目录定位index.php入口文件在文件系统中的绝对路径 .
  34. if ($fastcgi_script_name ~* "^(.+\.php)(/.+)$" ) {
  35. set $fastcgi_script_name_new $1;
  36. set $path_info $2;
  37. }
  38. #对fastcgi.conf中的SCRIPT_FILENAME和SCRIPT_NAME fastcgi参数进行重写,目的是指定入口文件在文件系统中的绝对路径给script_filename参数,让fastcgi知道index.php文件位置。
  39. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name_new;
  40. fastcgi_param SCRIPT_NAME $fastcgi_script_name_new;
  41. #定义一个新的nginx服务器传递给fastcgi的参数PATH_INFO,thinkphp需要这个入口文件index.php后的pathinfo信息
  42. fastcgi_param PATH_INFO $path_info;
  43. }
  44. error_page 500 502 503 504 /50x.html;
  45. location = /50x.html {
  46. root /web/online/x9169e_xyz;
  47. }
  48. }
  49. server {
  50. listen 443 ssl;
  51. #配置HTTPS的默认访问端口为443。
  52. #如果未在此处配置HTTPS的默认访问端口,可能会造成Nginx无法启动。
  53. #如果您使用Nginx 1.15.0及以上版本,请使用listen 443 ssl代替listen 443和ssl on。
  54. server_name x9169e.xyz;
  55. root /web/online/x9169e_xyz;
  56. index index.html index.htm;
  57. ssl_certificate /etc/nginx/ssl/x9169e_xyz/START_x9169e_xyz.pem;
  58. ssl_certificate_key /etc/nginx/ssl/x9169e_xyz/START_x9169e_xyz.key;
  59. ssl_session_timeout 5m;
  60. ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
  61. #表示使用的加密套件的类型。
  62. ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3; #表示使用的TLS协议的类型,您需要自行评估是否配置TLSv1.1协议。
  63. ssl_prefer_server_ciphers on;
  64. if ($host != "x9169e.xyz") {
  65. return 301 https://x9169e.xyz$request_uri;
  66. }
  67. location / {
  68. root /web/online/x9169e_xyz;
  69. index index.php index.html index.htm;
  70. if (!-e $request_filename){
  71. rewrite ^(.*)$ /index.php?s=$1 last;
  72. break;
  73. }
  74. }
  75. location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css|html)$ {
  76. #禁止缓存,每次都从服务器请求
  77. expires 1d;
  78. }
  79. location ~ \.php$ {
  80. root /web/online/x9169e_xyz;
  81. fastcgi_split_path_info ^(.+\.php)(.*)$;
  82. fastcgi_pass 127.0.0.1:9000;
  83. #包含nginx服务器传递给fastcgi程序的参数,php中通过$_SERVER['参数名']可获取
  84. include fastcgi.conf;
  85. set $path_info "";
  86. set $fastcgi_script_name_new $fastcgi_script_name;
  87. #判断url是否是pathinfo形式的,如果是则把这个url分割成两部分,index.php入口文件之后的pathinfo部分存入$path_info变量中,剩下的部分和$document_root根目录定位index.php入口文件在文件系统中的绝对路径 .
  88. if ($fastcgi_script_name ~* "^(.+\.php)(/.+)$" ) {
  89. set $fastcgi_script_name_new $1;
  90. set $path_info $2;
  91. }
  92. #对fastcgi.conf中的SCRIPT_FILENAME和SCRIPT_NAME fastcgi参数进行重写,目的是指定入口文件在文件系统中的绝对路径给script_filename参数,让fastcgi知道index.php文件位置。
  93. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name_new;
  94. fastcgi_param SCRIPT_NAME $fastcgi_script_name_new;
  95. #定义一个新的nginx服务器传递给fastcgi的参数PATH_INFO,thinkphp需要这个入口文件index.php后的pathinfo信息
  96. fastcgi_param PATH_INFO $path_info;
  97. }
  98. }