[英]PHP nginx server Virtual host redirect error
當我在url中使用本地主機時,它將重定向到我的項目,但是當我使用myproject.127.0.0.1.xip.io時,它將顯示服務器未找到錯誤。 下面是我的代碼。
提前致謝
server {
listen 127.0.0.1:80;
server_name myproject.127.0.0.1.xip.io;
root /var/www/dev.myproject.com/webroot;
index index.html index.php;
# set expiration of assets to MAX for caching
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
expires max;
try_files $uri /index.php;
# log_not_found off;
}
location / {
# Check if a file or directory index file exists, else route it to index.php.
try_files $uri $uri/ /index.php;
}
location ~* \.php$ {
try_files $uri /index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
# With php5-fpm:
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_read_timeout 300;
include fastcgi_params;
}
client_max_body_size 10M;
}
主機名可能無法解析,是否已將127.0.0.1 myproject.127.0.0.1.xip.io
記錄添加到/ etc / hosts文件中?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.