title: "Nginx_laravel_conf" date: 2024-01-04T14:27:11+07:00
根據實際環境做調整
server {
listen 80;
server_name _ ;
index index.php index.html default.html default.htm default.php;
root /web/lararoot/public/;
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php$is_args$query_string;
}
#error_page 404 /404.html;
# Deny access to PHP files in specific directory
#location ~ /(wp-content|uploads|wp-includes|images)/.*\.php$ { deny all; }
location ~ [^/]\.php(/|$){
try_files $uri =404;
fastcgi_pass unix:/tmp/php-cgi8.1.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
add_header 'Access-Control-Allow-Origin' '*.qieqie.cc';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
expires 30d;
}
location ~ .*\.(js|css)?$ {
expires 12h;
}
location ~ /.well-known {
allow all;
}
location ~ /\. {
deny all;
}
access_log /var/log/a.log main1;
error_log /var/log/a_err.log;
}