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

How to install nginx in linux

2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Linux how to install nginx, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Installation dependency

Yum install gcc

Yum install pcre-devel

Yum install zlib zlib-devel

Yum install openssl openssl-devel

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

Download the tar package for nginx

/ / 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.g

Install nginx

/ / enter the nginx directory cd / usr/local/nginx// to execute the command. / configure

/ / execute make command make// execute make install command make install

Nginx common commands

/ / Test / nginx/sbin/nginx-t under the installation path of the configuration file

/ / start command / nginx/sbin/nginx// stop command / nginx/sbin/nginx-s stop under the installation path or / nginx/sbin/nginx-s reload under the nginx-s quit// restart command installation path

/ / View process command ps-ef | grep nginx

/ / smoothly restart kill-HUP Nginx main process number

Configure the firewall

/ / Open firewall file sudo vim / etc/sysconfig/iptables// add new line open port 80-An INPUT-p tcp-m state-- state NEW-m tcp-- dport 80-j ACCEPT// save back

/ / restart firewall sudo service iptables restart

Nginx Virtual Domain name configuration and Test Verification

/ / Edit nginx.confsudo vim / usr/local/nginx/conf/nginx.conf// add line include vhost/*.conf// save exit

/ / create a new vhost folder in the / usr/local/nginx/conf directory mkdir vhost// to create a configuration sudo vim jimisun.com.conf// node for each domain name to add response configuration port forwarding or access to the file system

Nginx start

/ / enter the nginx installation directory cd sbinsudo. / nginx

Test access

Http://ip address

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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

Internet Technology

Wechat

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

12
Report