在我的 ubuntu nginx 服务器的根文件夹中有一个正在运行的 Laravel 应用程序。现在我正在尝试创建一个子域并在那里运行另一个 Laravel 应用程序。例如,
这是我目前的配置;
在/etc/nginx/sites-available/api.devport.findosman.xyz
server {
listen 80;
listen [::]:80;
root /var/www/api-devport;
index index.php index.html index.htm;
server_name api.devport.findosman.xyz;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
}
location ~ /\.ht {
deny all;
}
}
这是/etc/nginx/sites-enabled/api.devport.findosman.xyz
server {
listen 80;
listen [::]:80;
root /var/www/api-devport;
index index.php index.html index.htm;
server_name api.devport.findosman.xyz;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
}
location ~ /\.ht {
deny all;
}
}
在 /var/www/api-devport
中,我目前只有一个 index.php
文件,其中只有 <?php echo "hello world"?>
根文件夹项目运行良好。但无论我在哪里尝试访问 devport.findosman.xyz
,它都显示无法访问该站点。
如何克服这个问题?提前致谢。