laravel phpstudy nginx本地報錯404 找不到頁面

1.自己新項目laravel框架  配置好後,打開報錯404(phpstudy nginx配置)

先把基礎的配置配好,然後你的vhosts.conf出現下面這種情況

server {
        listen       80;
        server_name  bo.mooby.com mooby.com;
        root   "E:\phpstudy\PHPTutorial\WWW\mooby\public";
        location / {
            index  index.html index.htm index.php;
        }
        location ~ \.php(.*)$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            include        fastcgi_params;
        }
}

再location裏面少一行代碼 try_files $uri $uri/ /index.php?$query_string;

修改代碼後:

 server {
        listen       80;
        server_name  bo.mooby.com;
        root    "E:\phpstudy\PHPTutorial\WWW\mooby\public";
        location / {
            index  index.html index.htm index.php;
            try_files $uri $uri/ /index.php?$query_string;  
        }

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

        location ~ \.php(.*)$  {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            include        fastcgi_params;
        }

     
    }

 

但是有的人複製了少的哪行代碼進去,nginx就會啓動不了,這有可能是因爲你沒有專業的打開文檔的軟件,你是用winds自帶的打開文檔方法,所以導致代碼被默認的轉化了,所以下載一個打開文檔不會改變樣式的軟件,OK了

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章