我正在开发一个 laravel 应用程序。我的服务器配置如下:
server {
listen 80;
server_name dev.site.com;
return 301 https://dev.site.com$request_uri;
}
server {
listen 443 ssl http2;
ssl_certificate /chain.key;
ssl_certificate_key /private.key;
server_name dev.site.com;
root /home/site/backend/dev-app/current/public;
index index.php;
charset utf-8;
gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6].";
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_comp_level 9;
fastcgi_buffers 8 16k;
fastcgi_buffer_size 32k;
fastcgi_read_timeout 180;
location ~* \.(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
}
location / {
index index.html index.htm index.php; #try static .html file first
##try_files $uri $uri/ /index.php; <<Wrong!! this will break bundles like OneAuth for example
try_files $uri $uri/ /index.php?$query_string;
}
# catch all
error_page 404 /index.php;
#set client_max_body_size
client_max_body_size 100m;
#set client_body_buffer_size
client_body_buffer_size 128k;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.3-fpm-site.sock;
}
}
我已经配置了 ci/cd,它会将新版本的应用程序下载到服务器,并将 /home/site/backend/dev-app/current 符号链接更新到这个新位置。更新符号链接的命令是:
ln -nfs /home/site/backend/new_release /home/site/backend/dev-app/current
但此更新不影响 nginx。网站仍像旧网站一样运行。我应该怎么做才能使符号链接影响 nginx?
更新型多巴胺
经过一番研究,我发现 nginx 可以正确创建文件夹,但应用程序本身仍然返回错误的结果。那会是什么呢?