Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the steps to install nginx under linux

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about the steps to install nginx under linux, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

Nginx (engine x) is a high-performance HTTP and reverse proxy web server that can be compiled and run on most Unix Linux OS while also providing IMAP/POP3/SMTP services.

1. Install dependency packages

/ / install the above four dependencies yum-y install gcc zlib zlib-devel pcre-devel openssl openssl-devel with one click

two。 Download and extract the installation package

/ / create a folder cd / usr/localmkdir nginxcd nginx// download tar package wget http://nginx.org/download/nginx-1.13.7.tar.gztar-xvf nginx-1.13.7.tar.gz

3. Install nginx

/ / enter the nginx directory cd / usr/local/nginx// enter the directory cd nginx-1.13.7// execute the command. / configure// execute the make command make// execute the make install command make install

4. Configure nginx.conf

# Open the configuration file vi / usr/local/nginx/conf/nginx.conf

Change the port number to 8089, because apeache may occupy port 80, apeache port should not be modified as far as possible, we choose to modify nginx port.

Change localhost to your server ip address.

5. Start nginx

/ usr/local/nginx/sbin/nginx-s reload

If an error occurs: nginx: [error] open () "/ usr/local/nginx/logs/nginx.pid" failed

Then run: / usr/local/nginx/sbin/nginx-c / usr/local/nginx/conf/nginx.conf

Just start it again!

Check to see if the nginx process starts:

Ps-ef | grep nginx

6. If you want to connect to the virtual machine access port 192.168.131.2 using an external host, you need to turn off the firewall of the virtual machine:

CentOS6 and previous versions use the command: systemctl stop iptables.service

CentOS7 turn off firewall command: systemctl stop firewalld.service

Then visit the ip to see the nginx interface.

7. Visit the server ip to view (Note, since I am still listening on port 80, the port number after ip is omitted)

Installation completion of general common commands

Enter the installation directory

Command: cd / usr/local/nginx/sbin

Start, shut down, restart, command:

. / nginx start

. / nginx-s stop closed

. / nginx-s reload restart

These are the steps of installing nginx under linux. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report