当我在url中使用localhost然后它重定向到我的项目但是当我使用myproject.127.0.0.1.xip.io时它会显示Server not found错误。以下是我的代码。
提前致谢
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;
}
答案 0 :(得分:-1)
可能无法解析主机名,是否添加了主机名
127.0.0.1 myproject.127.0.0.1.xip.io
记录到/ etc / hosts文件?