Home  >  Article  >  Operation and Maintenance  >  Install nginx from linux source code

Install nginx from linux source code

马冠亚
马冠亚Original
2020-07-09 11:22:08197browse

Preface

nginx source code download address:

wget http://nginx.org/en/download.html

You can also download it in advance and upload it to the server.

1. Unzip the downloaded source code package

tar –zvxf nginx-1.10.3

2. Unzip the downloaded source code package:

tar –zvxf nginx-1.10.3

3. Install the extensions required by nginx:

yum install -y gcc gcc-c++ && pcre pcre-devel && zlib zlib-devel

1. Configuration:

./configure

2. Compile and install

make && make install

To test whether it is successful, enter the sbin directory under the nginx installation directory, start nginx, and start the command ./nginx

There is another The startup method can be entered:

/usr/local/nginx/sbin/nginx

Check the nginx process:

ps -ef|grep nginx

Visit the linux IP offline and check whether the access is successful

Test whether you can successfully enter the sbin directory under the nginx installation directory, start nginx, and start the command

./nginx

You can also enter:

/usr/local/nginx/sbin/nginx

View nginx process:

ps -ef|grep nginx

Offline access to linuxIP

Check whether access is successful


Note:

For offline access, port 80 must be opened or the firewall must be closed directly

1.CentOS7 opens port 80:

/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
firewall-cmd --zone=public --add-port=80/tcp --permanent

Command meaning:

--zone #Scope

--add-port=80/tcp # Add a port, the format is: port/communication protocol

--permanent #It will take effect permanently, it will be invalid after restarting without this parameter

The above is the detailed content of Install nginx from linux source code. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn