Nginx配置-通过nginx访问项目

.新建html2与html3两个网站项目测试,而html是本身就有,记得到/etc/hosts 添加dns记录

2.修改nginx.conf文件

3.测试访问

中间用到一些nginx的命令,就不截图,可以查看下面

*******************************************************************************************************************************

nginx -t  验证配置信息是否正确(常用)

nginx -V  查看版本

nginx  启动nginx服务器(常用)

nginx -s stop  快速停止或关闭nginx

nginx -s quit  正常停止或关闭nginx(常用)

nginx -s reload  配置文件修改重装载命令

 

 

php的sever写法

        server {
                listen  80;
                server_name localhost;
                location / {
                                root  /www/zgj/;
                                index index.html;
                        }

                location ~ \.php$ {
                        root /www/zgj/;
                        fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                        fastcgi_index index.php;
                        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                        include fastcgi_params;
                }
        }

server 

posted @ 2019-06-19 11:10  死神敲键  阅读(656)  评论(0)    收藏  举报