Home > Article > Backend Development > Installation and basic configuration of nginx, and multiple domain name services
centos6.x yum does not have nginx software package by default
Installation method:
Go to the nginx download page http://nginx.org/en/linux_packages.html#stable and copy the nginx software source installation package of CENTOS 6
Run the command: wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
Install the rpm package yum install nginx-release-centos-6-0.el6.ngx.noarch.rpm -y , this step actually just adds the nginx package source
Execute yum install nginx -y to install nginx
nginx is installed as a Linux service by default
Use service nginx start, stop, restart, try-restart, reload, force-reload, status to operate nginx
nginx’s configuration file reads the /etc/nginx/nginx.conf file by default
The configuration of nginx is composed of directives, which are composed of simple instructions or block instructions
Simple command: listen 80;
Block instructions are included by {}, and block instructions can include multiple simple instructions and block instructions:
http {
server {
}
}
http can have multiple servers, and multiple servers can listen to multiple ports and provide services for multiple applications on the same server. .
But if you have multiple domain names www.you.com, news.you.com, mail.you.com serving on the same server at the same time, then www.you.com, mail.you.com:8080, news.you The access method like .com:81 is obviously inappropriate. Fortunately, nginx has provided rules for filtering by domain name
server
{
listen 80;
server_name www.you.com;
location / {
#....
proxy_pass http://localhost:8880;
}
##### other directive
}
server
{
listen 80;
server_name news.you.com;
location / {
#....
proxy_pass http://localhost:8881;
}
##### other directive
}
server
{
listen 80;
server_name mail.you.com;
location / {
#....
proxy_pass http://localhost:8882;
}
##### other directive
}
In the end, just run each application and listen to the corresponding port.
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });The above has introduced the installation and basic configuration of nginx, as well as multiple domain name services, including related content. I hope it will be helpful to friends who are interested in PHP tutorials.