search
HomeOperation and MaintenanceNginxHow to install nginx on Linux system

Nginx (engine x) is a high-performance HTTP and reverse proxy web server known for its stability, rich feature set, sample configuration files and low system resource consumption.

nginx introduction:

  • Nginx (engine x) is a high-performance HTTP and reverse proxy web server. Nginx is a lightweight Large-scale web server/reverse proxy server and email (IMAP/POP3) proxy server.

  • Released under the BSD-like license. Its characteristics are that it occupies less memory and has strong concurrency capabilities. In fact, nginx's concurrency capabilities perform better among web servers of the same type. Users of nginx websites in mainland China include: Baidu, JD.com, Sina, NetEase, Tencent, Taobao, etc.

Detailed steps to install nginx on Linux system

1.Install dependency packages

 //一键安装上面四个依赖
 
 yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel

2.Download and unzip Installation package

 //创建一个文件夹
 
 cd /usr/local
 
 mkdir nginx
 
 cd nginx
 
 //下载tar包
 
 wget http://nginx.org/download/nginx-1.13.7.tar.gz
 
 tar -xvf nginx-1.13.7.tar.gz

3. Install nginx

 //进入nginx目录
 
 cd /usr/local/nginx
 
 //进入目录
 
 cd nginx-1.13.7
 
 //执行命令
 
 ./configure
 
 //执行make命令
 
 make
 
 //执行make install命令
 
 make install

4. Configure nginx.conf

 # 打开配置文件
 
 vi /usr/local/nginx/conf/nginx.conf

Change the port The number was changed to 8089 because apeache may occupy port 80. Try not to modify the apeache port. We chose to modify the nginx port.

Change localhost to your server IP address.

How to install nginx on Linux system

5. Start nginx

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

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

Run: /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

Start again That’s it!

Check whether the nginx process is started:

ps -ef | grep nginx

How to install nginx on Linux system

6. If you want to use an external host to connect Access port 192.168.131.2 on the virtual machine. 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 the firewall command: systemctl stop firewalld.service

Then access the ip to see the nginx interface.

7. Access the server IP to check (note, because I am still monitoring port 80, the port number after the IP is omitted)

How to install nginx on Linux system

The above is the detailed content of How to install nginx on Linux system. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:亿速云. If there is any infringement, please contact admin@php.cn delete
NGINX vs. Apache: Performance, Scalability, and EfficiencyNGINX vs. Apache: Performance, Scalability, and EfficiencyApr 19, 2025 am 12:05 AM

NGINX and Apache are both powerful web servers, each with unique advantages and disadvantages in terms of performance, scalability and efficiency. 1) NGINX performs well when handling static content and reverse proxying, suitable for high concurrency scenarios. 2) Apache performs better when processing dynamic content and is suitable for projects that require rich module support. The selection of a server should be decided based on project requirements and scenarios.

The Ultimate Showdown: NGINX vs. ApacheThe Ultimate Showdown: NGINX vs. ApacheApr 18, 2025 am 12:02 AM

NGINX is suitable for handling high concurrent requests, while Apache is suitable for scenarios where complex configurations and functional extensions are required. 1.NGINX adopts an event-driven, non-blocking architecture, and is suitable for high concurrency environments. 2. Apache adopts process or thread model to provide a rich module ecosystem that is suitable for complex configuration needs.

NGINX in Action: Examples and Real-World ApplicationsNGINX in Action: Examples and Real-World ApplicationsApr 17, 2025 am 12:18 AM

NGINX can be used to improve website performance, security, and scalability. 1) As a reverse proxy and load balancer, NGINX can optimize back-end services and share traffic. 2) Through event-driven and asynchronous architecture, NGINX efficiently handles high concurrent connections. 3) Configuration files allow flexible definition of rules, such as static file service and load balancing. 4) Optimization suggestions include enabling Gzip compression, using cache and tuning the worker process.

NGINX Unit: Supporting Different Programming LanguagesNGINX Unit: Supporting Different Programming LanguagesApr 16, 2025 am 12:15 AM

NGINXUnit supports multiple programming languages ​​and is implemented through modular design. 1. Loading language module: Load the corresponding module according to the configuration file. 2. Application startup: Execute application code when the calling language runs. 3. Request processing: forward the request to the application instance. 4. Response return: Return the processed response to the client.

Choosing Between NGINX and Apache: The Right Fit for Your NeedsChoosing Between NGINX and Apache: The Right Fit for Your NeedsApr 15, 2025 am 12:04 AM

NGINX and Apache have their own advantages and disadvantages and are suitable for different scenarios. 1.NGINX is suitable for high concurrency and low resource consumption scenarios. 2. Apache is suitable for scenarios where complex configurations and rich modules are required. By comparing their core features, performance differences, and best practices, you can help you choose the server software that best suits your needs.

How to start nginxHow to start nginxApr 14, 2025 pm 01:06 PM

Question: How to start Nginx? Answer: Install Nginx Startup Nginx Verification Nginx Is Nginx Started Explore other startup options Automatically start Nginx

How to check whether nginx is startedHow to check whether nginx is startedApr 14, 2025 pm 01:03 PM

How to confirm whether Nginx is started: 1. Use the command line: systemctl status nginx (Linux/Unix), netstat -ano | findstr 80 (Windows); 2. Check whether port 80 is open; 3. Check the Nginx startup message in the system log; 4. Use third-party tools, such as Nagios, Zabbix, and Icinga.

How to close nginxHow to close nginxApr 14, 2025 pm 01:00 PM

To shut down the Nginx service, follow these steps: Determine the installation type: Red Hat/CentOS (systemctl status nginx) or Debian/Ubuntu (service nginx status) Stop the service: Red Hat/CentOS (systemctl stop nginx) or Debian/Ubuntu (service nginx stop) Disable automatic startup (optional): Red Hat/CentOS (systemctl disabled nginx) or Debian/Ubuntu (syst

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.