Once in the company's Nginx forwarding Apache

Source: Internet
Author: User
Once in the company's Nginx forwarding Apache
Previously used Nginx is to let Nginx as a Web server to use, this time, because the machine already has Apache just worry about Apache load not enough to let Nginx agent A, in order to share some of the pressure, flow as follows
1. Download and install.
#安装pcre
[Root@xw_test ~]# TAR-XJF pcre-8.02.tar.bz2-c/usr/src/
[Root@xw_test ~]# cd/usr/src/pcre-8.02/
[Root@xw_test pcre-8.02]#./configure && make && make install
#安装nginx
[Root@xw_test ~]# useradd-m-s/sbin/nologin nginx
[Root@xw_test ~]# tar-xzf nginx-1.0.5.tar.gz-c/usr/src/
[Root@xw_test ~]# cd/usr/src/nginx-1.0.5/
[Root@xw_test nginx-1.0.5]#./configure--prefix=/usr/local/nginx--user=nginx--group=nginx
[Root@xw_test nginx-1.0.5]# make && make install
[Root@xw_test ~] #vim/usr/local/nginx/conf/nginx.conf
Here specific Nginx configuration file details Even if you can refer to the blog:
http://blog.csdn.net/superbirds/article/details/8136146
The first time to start Nginx, for the sake of conservative, it is better to start verifying that the configuration file has no syntax or configuration logic errors. You can verify the profile by using the following command:
/usr/local/nginx/sbin/nginx-t
If you get the results:
Nginx:the configuration file/usr/local/nginx/conf/nginx.conf syntax is OK
Nginx:configuration file/usr/local/nginx/conf/nginx.conf Test is successful
Proof nginx config file no hard error! You can try to start,
My side because of the machine has Apache, so directly to start an error, told the address already in use (port conflict), Nginx the default listening port and Apache is the same, are 80. So need to modify any one of the services of the listening port, I modified here is Nginx, modified to the same port as Apache.
It's yo ' Order:/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf
You can start Nginx
To this a nginx started successfully, but, is not finished, because has not been configured ^_^

2. Configure Nginx
It says, this time nginx is only used as a proxy, so there is no need to load other script parsers. Simply use the Nginx default module to open the Nginx default profile/usr/local/nginx/conf/nginx.conf Locate the first server node under the HTTP segment (the virtual host under Nginx is supported by the server node. Several servers represent several virtual hosts, but if you have multiple domain names that need to be bound, you can also replicate multiple server nodes of the same configuration, and then modify different server_name to bind multiple domain names to the same virtual host. )

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.