우리는 Laravel 프레임 워크를 사용하는 웹 사이트에서 새로운 섹션을 소개합니다. 하위 디렉터리에 배치됩니다 (예 : /newsection
). 이전의 다시 쓰기 규칙과 충돌하지 않고 nginx.conf를 어떻게 설정해야합니까?중첩 된 Laravel 프로젝트 Nginx 구성
이는 내가 일을 알고있는 대부분의 프레임 워크처럼 작동하는 경우이 404의 대체 URI에 추가 /newsection
을 제거하려고 반환하면 내 현재 nginx.conf
server {
listen 80;
server_name localhost www.website.com;
root /home/www/website;
index index.html index.php;
location /newsection/ {
rewrite ^/ /newsection/public/index.php last;
# this is my attempt at it
}
location/{
try_files $uri $uri/ @rewrite;
}
location /php-status {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}
location @rewrite {
rewrite ^/([\w_-]+)/?$ /index.php?page=$1 last;
rewrite ^/([\w_-]+)/([\w_-]+)/?$ /index.php?page=$1&slug=$2 last;
rewrite ^/([\w_-]+)/([\w_-]+)/([\w_-]+)/?$ /index.php?page=$1&slug=$2&pagination=$3 last;
}
include php.conf;
}
나는 환자가 아니므로 하위 도메인 솔루션을 사용하기로 결정했습니다. 시간을 찾으면 나는 당신의 답을 시험 할 것입니다. 감사. – bukka