site.conf 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. server {
  2. server_name localhost;
  3. listen 80 default_server;
  4. #listen 443 ssl;
  5. #ssl_certificate /usr/local/openresty/nginx/conf/conf.d/ssl/mapi.jstyle.cn.pem;
  6. #ssl_certificate_key /usr/local/openresty/nginx/conf/conf.d/ssl/mapi.jstyle.cn.key;
  7. autoindex on;
  8. gzip on;
  9. gzip_min_length 1k;
  10. gzip_comp_level 2;
  11. gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
  12. gzip_vary on;
  13. gzip_disable "MSIE [1-6]\.";
  14. location ~* ^.+\.(ico|gif|jpg|jpeg|png)$ {
  15. add_header Access-Control-Allow-Origin *;
  16. add_header Access-Control-Allow-Headers X-Requested-With;
  17. add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
  18. access_log off;
  19. expires 30d;
  20. }
  21. location ~* ^.+\.(css|js|txt|xml|swf|wav)$ {
  22. access_log off;
  23. expires 24h;
  24. }
  25. location ~* ^.+\.(eot|ttf|otf|woff|svg)$ {
  26. access_log off;
  27. expires max;
  28. }
  29. set $charset utf-8;
  30. charset $charset;
  31. set $rootdir /www;
  32. if ( $request_uri ~* ^/(dever_package\/manage|dever_package\/ui|dever_package\/script) ) {
  33. set $rootdir /share/lib/php;
  34. }
  35. root $rootdir;
  36. index index.php index.html;
  37. if ( $request_uri ~* /(applet\/content|applet_on\/content) ) {
  38. rewrite ^/(.*)/content/(.*) /$1/content/index.php?$2 last;
  39. }
  40. if ( $request_uri ~* /typecho ) {
  41. rewrite ^/typecho/index.php/(.*?) /typecho/index.php?$1 last;
  42. }
  43. if ( $request_uri ~* /log\/data.add ) {
  44. rewrite ^/log/(.*?) /log/index.php?$1 last;
  45. }
  46. if ( $request_uri ~* /system/wechat ) {
  47. rewrite ^/system/wechat /system/index.php?m=payment&a=wechat_notify last;
  48. }
  49. if ( $request_uri ~* /pay/pay/notify ) {
  50. rewrite ^/pay/pay/notify/([0-9+]) /pay/pay/index.php?l=api.notify&account_id=$1 last;
  51. }
  52. if ( $request_uri ~* /public ) {
  53. rewrite ^/(.*)/public/(.*) /$1/public/index.php?$2 last;
  54. }
  55. location / {
  56. # First attempt to serve request as file, then
  57. # as directory, then fall back to displaying a 404.
  58. try_files $uri $uri/ =404;
  59. # Uncomment to enable naxsi on this location
  60. # include /etc/nginx/naxsi.rules
  61. }
  62. #location ~ ^(.*)$ {
  63. location ~ \.php$ {
  64. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  65. # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini (No settings!)
  66. # With php-cgi alone:
  67. #fastcgi_pass web-php7_swoole:9000;
  68. fastcgi_pass web-php7:9000;
  69. #fastcgi_pass web-php5:9000;
  70. # With php-fpm:
  71. #fastcgi_pass unix:/var/run/php7-fpm.sock;
  72. fastcgi_index index.php;
  73. fastcgi_param SCRIPT_FILENAME $rootdir/$fastcgi_script_name;
  74. #fastcgi_param PATH_INFO $fastcgi_path_info;
  75. include fastcgi_params;
  76. }
  77. }
  78. #server {
  79. #server_name wx.shemic.com;
  80. #listen 80; # 或者 443,如果你使用 HTTPS 的话
  81. #ssl on; 是否启用加密连接
  82. #如果你使用 HTTPS,还需要填写 ssl_certificate 和 ssl_certificate_key
  83. #location / { # 如果你希望通过子路径访问,此处修改为子路径,注意以 / 开头并以 / 结束
  84. #proxy_pass http://wx.shemic.com:5000/;
  85. #}
  86. #}