Linux yum install Nginx

Build Nginx static server

Install Nginx

Install Nginx with yum:

yum install nginx -y
  1. Modify /etc/nginx/conf.d/default.conf to remove monitoring of IPv6 addresses.
  2. i enter to modify esc to exit editing: x to save.
vim /etc/nginx/conf.d/default.conf

Configuration example

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

}

After the modification is complete, start Nginx:

nginx

At this point, you can visit the external network HTTP service ( http://IPAddress) of the experimental machine to confirm whether the installation is successful .

Set Nginx to start automatically at boot:

chkconfig nginx on

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325167650&siteId=291194637
Recommended