簡體   English   中英

PHP Nginx服務器虛擬主機重定向錯誤

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM