server { listen 8080 ; server_name localhost; set $root /var/www/myweb; #listen 443 ssl; #ssl_certificate *.pem; #ssl_certificate_key *.key; #ssl_session_timeout 5m; #ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4; #ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #ssl_prefer_server_ciphers on; location ~ .*\.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ { root $root; client_max_body_size 100M; } location / { index index.php; if (!-e $request_filename) { rewrite ^/(.*)$ /index.php/$1 last; break; } root $root; client_max_body_size 100M; } location ~ \.php/?.*$ { root $root; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi_params; set $fastcgi_script_name2 $fastcgi_script_name; if ($fastcgi_script_name ~ "^(.+\.php)(/.+)$") { set $fastcgi_script_name2 $1; set $path_info $2; } fastcgi_param PATH_INFO $path_info; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name2; fastcgi_param SCRIPT_NAME $fastcgi_script_name2; client_max_body_size 100M; } location /ngx_status { stub_status on; access_log off; allow 127.0.0.1; deny all; } include /etc/nginx/mime.types; default_type application/octet-stream; }
原文:https://www.cnblogs.com/dongqiliang/p/12305742.html