CENTOS 6.5 configuration Yum installation Nginx

Source: Internet
Author: User
Tags nginx server

Summary: This article describes how to install Nginx with Yum source

The first step is to create a source configuration file Nginx.repo in the/etc/yum.repos.d/directory:

cd/etc/Yumrepos.d/vim Nginx.repo

Fill in the following content:

[Nginx]name=nginx repobaseurl=http://nginx.org/packages/centos/$releasever/$ basearch/gpgcheck=0Enabled=1

Saved, a/etc/yum.repos.d/nginx.repo file is generated.

The following instructions can be executed directly below to install Nginx automatically:

Yum Install nginx-y

The installation is complete, the following directly can start Nginx:

/etc/init.d/nginx start

Now Nginx has been launched, direct access to the server will be able to see the Nginx Welcome page.

If you are still unable to access it, you need to configure your Linux firewall.

5  -M state--state new,established-J acceptservice iptables saveservice iptables Restart

Nginx command and configuration file location:

/etc/init.d/nginx Start # start Nginx service /etc/init.d/nginxStop # Stop Nginx service /etc/nginx/nginx.conf # Nginx Configuration file Location

At this point, Nginx has been fully configured to complete the installation.

default.conf configuration file settings in Nginx server, Normal, nginx.conf configure the corresponding information when the shunt request is generally set

Server {Listen the;    server_name boss.mydongjia.com; #charset Koi8-R; #access_log/var/log/nginx/log/Host.access.log Main; Location/ {
#这里设置代理服务器的地址和对应的端口和应用名称, in fact, is the agent's Project path address Proxy_pass http://127.0.0.1:8080/xxxxxx/;Proxy_set_header Host $host; Proxy_set_header remote_addr $remote _addr; Proxy_set_header X-real-IP $remote _addr; Proxy_set_header X-forwarded-For $proxy _add_x_forwarded_for; Root/usr/share/nginx/html; Index index.html index.htm; } #error_page404/404. html; # REDIRECT Server error pages to the static page/50x.html # Error_page - 502 503 504/50x.html; Location= /50x.html {root/usr/share/nginx/html; }}

CENTOS 6.5 configuration Yum installation Nginx

Related Article

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.