2014-10-27 73 views
0

當我在url中使用localhost時,它重定向到我的項目,但是當我使用myproject.127.0.0.1.xip.io時,它顯示服務器未找到錯誤。以下是我的代碼。PHP nginx服務器虛擬主機重定向錯誤

在此先感謝

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; 
} 

回答

-1

大概主機名無法解析,你加入了 127.0.0.1 myproject.127.0.0.1.xip.io 記錄到/ etc/hosts文件?