服务器上的域可以毫无问题地访问。我还想访问一些独立于域的文件夹。
debain服务器上的文件结构:
+-- var
+-- www
+-- domains
+-- domain.com
+-- otherdomain.com
+-- apps
+-- folder1
+-- index.php对于这些域,我在/etc/nginx/sites-enabled中有一个配置文件。来自一个域的配置如下所示:https://pastebin.com/S09DnEmv,并且正在工作。
现在我想在/var/www/apps/folder1/中访问index.php,这应该包含在nginx的默认配置中。
默认配置:
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/;
index index.php index.html index.htm index.nginx-debian.html;
server_name _;
location / {
try_files $uri $uri/ =404;
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
if (!-f $document_root$fastcgi_script_name) {
return 404;
}
# Mitigate https://httpoxy.org/ vulnerabilities
fastcgi_param HTTP_PROXY "";
# fastcgi_pass 127.0.0.1:9000;
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
fastcgi_index index.php;
# include the fastcgi_param setting
include fastcgi_params;
}
}根据我对使用root /var/www/;的理解,我应该能够访问任何文件夹中的文件。当我试图访问文件时,我登陆到了nginx默认的404页面。当我尝试仅使用IP地址在浏览器中访问服务器时,也会发生这种情况
发布于 2020-06-09 13:45:17
这实际上是我在这里遇到的一个小问题。
在我的默认配置中,我将server_name _;更改为server_name [IP ADDRESS GOES HERE];
https://stackoverflow.com/questions/62255905
复制相似问题