关闭

CentOS下nginx解析本地虚拟域名

194人阅读 评论(0) 收藏 举报
分类:

nginx配置文件中,server_name配置一个虚拟域名,要到/etc/hosts下增加一个本地域名127.0.0.1 www.abc.com

server
        {
                listen 80;
                #listen [::]:80;
                server_name www.abc.com;
                index index.html index.htm index.php default.html default.htm default.php;
                root  /home/wwwroor/www.abc.com/public;

                include none.conf;
                #error_page   404   /404.html;
                location ~ [^/]\.php(/|$)
                        {
                                # comment try_files $uri =404; to enable pathinfo
                                try_files $uri =404;
                                fastcgi_pass  unix:/tmp/php-cgi.sock;
                                fastcgi_index index.php;
                                include fastcgi.conf;
                                #include pathinfo.conf;
                        }

                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
                        {
                                expires      30d;
                        }

                location ~ .*\.(js|css)?$
                        {
                                expires      12h;
                        }

                access_log off;
        }


0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场