【发布时间】:2017-05-29 20:47:12
【问题描述】:
server {
server_name mediaserver.localdomain;
listen 80;
index index.php index.htm index.html;
root /var/www/html/Organizr;
location = / {
root /var/www/html/Organizr;
}
location /homelab {
alias /opt/homelab/;
}
location ~ /\.git {
deny all;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
包括sn-ps/fastcgi-php.com; =
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# Check that the PHP script exists before passing it
try_files $fastcgi_script_name =404;
# Bypass the fact that try_files resets $fastcgi_path_info
# see: http://trac.nginx.org/nginx/ticket/321
set $path_info $fastcgi_path_info;
fastcgi_param PATH_INFO $path_info;
fastcgi_index index.php;
include fastcgi.conf;
这是我的配置,我一辈子都无法让它工作。
我的期望是让 http://mediaserver.localdomain/ 转到“/var/www/html/Organizr/index.php”
当我访问 http://mediaserver.localdomain/homelab/ 时,它会拉取“/opt/homelab/index.php”
但只有 http://mediaserver.localdomain/ 对 /homelab/ 不起作用
我已经用尽了我的谷歌管理技术和关于别名和根定义的 nginx 文档页面。
提前致谢。
仅供参考(我故意在链接中放置空格以摆脱自动链接)
【问题讨论】:
标签: php nginx configuration