ITPub博客

首页 > IT职业 > IT图书 > 四十八章 腾讯云Centos7.4 安装 Nginx

四十八章 腾讯云Centos7.4 安装 Nginx

IT图书 作者:usli 时间:2021-09-09 09:30:07 0 删除 编辑

一、安装

yum install nginx

二、启动

service nginx start

三、修改配置文件

1、cd /etc/nginx

2、vim nginx.conf 删除以下内容保存退出

server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }

}

3、cd conf.d

4、vim test.conf新建配置文件保存退出,文件内容如下

server {

        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }

}

四、重启

service nginx restart

备注:许多第一次安装Nginx的不知道要删除 nginx.conf的配置内容。


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/3324/viewspace-2803887/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-08-14

  • 博文量
    89
  • 访问量
    808