Home  >  Article  >  Operation and Maintenance  >  How to install Nginx under centos6.5

How to install Nginx under centos6.5

WBOY
WBOYforward
2023-05-14 09:34:051776browse

1. Configure yum source:

Create file:/etc/yum.repos.d/nginx.repo

touch /etc/yum.repos.d/nginx.repo

Edit the file,

vi /etc/yum.repos.d/nginx.repo

Write the following content:

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1

Save, now the yum source configuration is completed.

You can check whether the yum source is configured correctly by using the following command

yum list |grep nginx

The output is as follows:

How to install Nginx under centos6.5

indicates that the yum source is configured correctly.

2. Install nginx through yum

Execute the following instructions to install yum:

yum -y install nginx

Execute the following instructions to check whether nginx is installed successfully:

rpm -q nginx

3. Start nginx

service nginx start

As shown in the figure, the startup is successful:

How to install Nginx under centos6.5

4. View the nginx installation directory , and the directory where the configuration file (nginx.conf) is located

ps -aef|grep nginx

Output the following content:

How to install Nginx under centos6.5

The above is the detailed content of How to install Nginx under centos6.5. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete