Install nginx from linux source code

马冠亚
Release: 2020-07-09 13:13:03
Original
140 people have browsed it

Preface

nginx source code download address:

wget http://nginx.org/en/download.html
Copy after login

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
Copy after login
Copy after login

2. Unzip the downloaded source code package:

tar –zvxf nginx-1.10.3
Copy after login
Copy after login

3. Install the extensions required by nginx:

yum install -y gcc gcc-c++ && pcre pcre-devel && zlib zlib-devel
Copy after login

1. Configuration:

./configure
Copy after login

2. Compile and install

make && make install
Copy after login

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
Copy after login
Copy after login

Check the nginx process:

ps -ef|grep nginx
Copy after login
Copy after login

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
Copy after login

You can also enter:

/usr/local/nginx/sbin/nginx
Copy after login
Copy after login

View nginx process:

ps -ef|grep nginx
Copy after login
Copy after login

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
Copy after login

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!

Related labels:
1
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!