![nginx/HHVM 404, $document_root를 절대 경로로 바꾸는 문제가 수정되었지만 리디렉션은 URL에 경로를 추가합니다.](https://linux55.com/image/76149/nginx%2FHHVM%20404%2C%20%24document_root%EB%A5%BC%20%EC%A0%88%EB%8C%80%20%EA%B2%BD%EB%A1%9C%EB%A1%9C%20%EB%B0%94%EA%BE%B8%EB%8A%94%20%EB%AC%B8%EC%A0%9C%EA%B0%80%20%EC%88%98%EC%A0%95%EB%90%98%EC%97%88%EC%A7%80%EB%A7%8C%20%EB%A6%AC%EB%94%94%EB%A0%89%EC%85%98%EC%9D%80%20URL%EC%97%90%20%EA%B2%BD%EB%A1%9C%EB%A5%BC%20%EC%B6%94%EA%B0%80%ED%95%A9%EB%8B%88%EB%8B%A4..png)
설명된 것과 동일한 문제가 발생했습니다.이 문제$document_root
이를 절대 경로로 바꾸는 솔루션은 다음과 같이 리디렉션이 URL에 절대 경로를 추가할 때까지 작동합니다.
EXPECTED http://domain/pma/
REALITY http://domain/var/www/pma/
나는 답답한 마음에 머리카락을 잡아당기려고 했다. 대머리가 되지 않도록 도와주세요. (머리 정리 자체가 귀찮긴 하지만 요점은 알겠습니다)
$ less /etc/nginx/conf.d/default.conf
server {
listen 80;
server_name localhost;
#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;
location / {
root /usr/share/nginx/html;
index index.html index.htm index.php;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
include hhvm.conf;
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
}
$ less /etc/nginx/hhvm.conf
location ~ \.(hh|php)$ {
fastcgi_keep_conn on;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
답변1
지시어 root
가 내부적으로 정의되어 있어 location
문제가 발생합니다.
root
레벨에서 지시문을 직접 정의하면 hhvm.conf에서도 사용할 수 있는 server
변수의 올바른 값이 설정됩니다 .$document_root
server {
listen 80;
server_name localhost;
root /var/www;
location / {
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
include hhvm.conf;
}
그러면 귀하의 콘텐츠를 수정할 필요가 없습니다 hhvm.conf
.거기도 청소 좀 하고 있어.