2016-06-23 1 views
1

최근 Nothingx에 Laravel을 설치했습니다. Laravel 응용 프로그램 홈 페이지가 제대로 작동하지만 경로 페이지에 404 오류가 발생합니다. 내 Nginx 구성은 다음과 같습니다 :Nginx 서버 laravel 루트 디렉토리 404 오류

server { 
    listen 80 default_server; 
    listen [::]:80 default_server ipv6only=on; 

    root /var/www/html; 
    index index.html index.htm index.php; 

    server_name localhost; 

    location/{ 
      try_files $uri $uri/ /index.php?$query_string; 
      #try_files $uri $uri/ =404; 
      #try_files $uri $uri/ /index.php$is_args$args; 
    } 
    error_page 404 /404.html; 

    error_page 500 502 503 504 /50x.html; 
    location = /50x.html { 
      root /var/www/html; 
    } 


    location ~ \.php$ { 
      try_files $uri =404; 
      fastcgi_split_path_info ^(.+\.php)(/.+)$; 
      fastcgi_pass unix:/var/run/php5-fpm.sock; 
      fastcgi_index index.php; 
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
      include fastcgi_params; 
    } 
} 

내가 localhost/lar/public 같은 URL을 액세스 할 때, 그것을 잘 작동합니다. 경로가 선언되었지만 localhost/lar/public/test과 같은 URL에 액세스하면 404 오류가 발생합니다. 그냥 변경된 루트

+0

당신이 제대로'.env' 파일에'APP_URL'을 구성 했습니까? – miken32

+0

그래, .env 파일에 APP_URL을 올바르게 구성했습니다. 하지만 여전히 작동하지 않습니다 – Alien

+0

루트를'root/home/user_name/Documents/laravel_project_name/public; '과 같이 설정해야합니다. –

답변

5

에의/var/www/html/경/공공, 다음 경로가 제대로 작동