Basic use of the Linux Nginx

Source: Internet
Author: User

1. Installation

The installation and startup methods of the CentOS 7 Nginx are as follows

# yum Install nginx# firewall-cmd--permanent--zone=public--add-service=http# firewall-cmd--permanent--zone =public--add-service=https# firewall-cmd--reload# systemctl start nginx# systemctl enable Nginx

After the installation is complete, open the IP address of the server in the browser to test whether the installation was successful.

2. Configuration

Nginx main configuration file is/etc/nginx/nginx.conf, more detailed introduction to the end of the reference text

3. Forwarding

Forwarding is also called a forward proxy, and the following configuration forwards all HTTP requests to www.example.com

server {        listen       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/{            resolver   114.114.114.114;            Proxy_pass http://www.example.com:80;        }        Error_page 404/404.html;            Location =/40x.html {        }        error_page 502 503 504/50x.html;            Location =/50x.html {        }    }

Note: Nginx does not support HTTPS forward proxy.

Reference:
<nginx Configuration Primer >
<nginx Introduction and configuration file detailed >
<centos installation and configuration of Nginx >

Basic use of the Linux Nginx

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.