site.conf 3.8 KB

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