site.conf 3.9 KB

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