一,相关文档:
https://learnku.com/docs/laravel/10.x/deployment/14840
二, 配置nginx
1,站点文件
server {
listen 80;
#listen [::]:80;
server_name dig.lhdtest.com;
root /webdata/site/dig/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
index index.php;
access_log /webdata/logs/nginxlogs/dig.access_log;
error_log /webdata/logs/nginxlogs/dig.error_log;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
#fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
}
2,重启服务
[root@lhdpc conf.d]# systemctl restart nginx.service
三,测试效果:
四,查看laravel和nginx的版本:
laravel:
liuhongdi@lhdpc:/data/laravel/dignews$ php artisan --version
Laravel Framework 10.27.0
nginx:
liuhongdi@lhdpc:/data/laravel/dignews$ nginx -v
nginx version: nginx/1.18.0 (Ubuntu)
标签:laravel,index,log,10.27,nginx,php,fastcgi
From: https://www.cnblogs.com/architectforest/p/17778443.html