thinkphp nginx配置文件

xiaoxiao2021-02-28  74

server{   listen 80;   server_name xiaoqu168.com;   return 301 https://$server_name$request_uri; }

server {

    listen 443 ssl;     #listen 80;     server_name steak.youzhufang.cn;     ssl_certificate /etc/letsencrypt/live/steak.youzhufang.cn/fullchain.pem;     ssl_certificate_key /etc/letsencrypt/live/steak.youzhufang.cn/privkey.pem;     ssl_session_cache shared:SSL:1m;     ssl_session_timeout 5m;     ssl_ciphers HIGH:!aNULL:!MD5;     ssl_prefer_server_ciphers on;     access_log /data/wwwlogs/steak.youzhufang.cn_nginx.log combined;     index index.html index.htm index.php;     root /data/wwwroot/steak.youzhufang.cn/public;     location / {         if (!-e $request_filename) {             rewrite ^(.*)$ /index.php?s=/$1 last;             break;         }     }     location ~ \.php {         #fastcgi_pass remote_php_ip:9000;         fastcgi_pass unix:/dev/shm/php-cgi.sock;         fastcgi_index index.php;         include fastcgi_params;         set $real_script_name $fastcgi_script_name;         if ($fastcgi_script_name ~ "^(.+?\.php)(/.+)$") {             set $real_script_name $1;             set $path_info $2;         }         fastcgi_param SCRIPT_FILENAME $document_root$real_script_name;         fastcgi_param SCRIPT_NAME $real_script_name;         fastcgi_param PATH_INFO $path_info;         fastcgi_param DEBUG 1;         set $cors '';         set $allow '';         if ( $request_method = 'OPTIONS' ) { set $cors 'options'; }         if ( $http_origin ~ "^(http://localhost:8080|http://peigou.wdouw.cn)$" ) {             set $cors "${cors}1";             set $allow 'allow';         }         if ($cors = 'options1') {             add_header 'Access-Control-Allow-Origin' "$http_origin";             add_header 'Access-Control-Allow-Methods' 'DELETE,POST,PUT';             add_header 'Access-Control-Allow-Headers' 'Content-Type';             add_header 'Access-Control-Max-Age' 1728000;             add_header 'Content-Type' 'text/plain charset=UTF-8';             add_header 'Content-Length' 0;             add_header 'Access-Control-Allow-Credentials' 'true';             return 204;         }         if ($allow = 'allow') {             add_header 'Access-Control-Allow-Origin' "$http_origin";             add_header 'Access-Control-Allow-Credentials' 'true';         }     }     location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {         expires 30d;         access_log off;     }     location ~ .*\.(js|css)?$ {         expires -1;         access_log off;     } }
转载请注明原文地址: https://www.6miu.com/read-36570.html

最新回复(0)