Nginx installation and basic configuration, and multiple domain name services

Source: Internet
Author: User
centos6.x Yum does not have an Nginx package by default
Installation method:
to nginx download page http://nginx.org/en/linux_packages.html#stable, copy the CentOS 6 nginx software Source installation package
Run command: wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
Install RPM package Yum install nginx-release-centos-6-0.el6.ngx.noarch.rpm-y, this step is actually added to the Nginx package source
Run the Yum install Nginx-y and the Nginx will be ready.

Nginx is installed as a Linux service by default
Use the service Nginx start, stop, restart, Try-restart, Reload, force-reload, status to operate Nginx

Nginx config file reads the/etc/nginx/nginx.conf file by default
Nginx configuration is composed of directives, directives consists of simple instructions or block instructions
Simple instruction: Listen 80;
Block directives are contained by {}, and block instructions can contain multiple simple and chunk instructions:

{    server {    }}

HTTP can have more than one server, and multiple servers can listen to multiple ports on the same server to serve multiple applications.
But if you have multiple domain name www.you.com,news.you.com at the same time, mail.you.com service on the same server, then www.you.com,mail.you.com:8080, news.you.com : 81 Such access is obviously inappropriate, and fortunately, Nginx has already provided rules for filtering through domain names.

server{    80;    server_name www.you.com;    location / {        #....        proxy_pass http://localhost:8880;    }    ##### other directive}server{    80;    server_name news.you.com;    location / {        #....        proxy_pass http://localhost:8881;    }    ##### other directive}server{    80;    server_name mail.you.com;    location / {        #....        proxy_pass http://localhost:8882;    }    ##### other directive}

Finally, each application can be run to listen to the corresponding port.

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('
  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above describes the installation and basic configuration of nginx, and a number of domain name services, including the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.