server {
listen 80;
server_name 123456.com 1234567.com;
root "/data/web/123/public";
#add_header Access-Control-Allow-Origin *;
#add_header Access-Control-Allow-Headers *;
#add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
location / {
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
return 204;
}
index index.html index.htm index.php;
#autoindex on;
if (!-e $request_filename)
{
rewrite ^(.*)$ /index.php?s=/$1 last; break;
}
}
location ~ .*\.(txt)$
{
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ \.php(.*)$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;
fastcgi_param PT_ENV ALIYUN;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
location ~* /(\.svn|CVS|Entries|\.git|\.ht){
deny all;
}
}
nginx配置
于 2024-04-07 18:04:49 首次发布