Download the secure terminal mobaxterm_personal
First, after downloading the secure terminal, connect to your own public network ip
The connection is successful The display is as above.
nginx Introduction
nginx is a lightweight web server and reverse proxy server. Compared with apache and lighttpd, it has the advantages of less memory and high stability. Its most common use is to provide a reverse proxy service
After connecting to the server
The first step: install gcc gcc-c
The command is :
yum install -y gcc gcc-c++
Step 2: Install the pcre library
$ cd /usr/local/ $ wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.33/pcre-8.33.tar.gz $ tar -zxvf pcre-8.36.tar.gz $ cd pcre-8.36 $ ./configure $ make && make install
If an error is reported: configure: error: you need a c compiler for c support
Solution: yum install -y gcc gcc-c
Step 3: Install ssl library
$ cd /usr/local/ $ wget http://www.openssl.org/source/openssl-1.0.1j.tar.gz $ tar -zxvf openssl-1.0.1j.tar.gz $ cd openssl-1.0.1j $ ./config $ make && make install
Step 4: Install zlib inventory
$ cd /usr/local/ $ wget http://zlib.net/zlib-1.2.11.tar.gz $ tar -zxvf zlib-1.2.11.tar.gz $ ./configure $ make && make install
Step 5: Install nginx
$ cd /usr/local/ $ wget http://nginx.org/download/nginx-1.8.0.tar.gz $ tar -zxvf nginx-1.8.0.tar.gz $ cd nginx-1.8.0 $ ./configure --user=nobody --group=nobody --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_gzip_static_module --with-http_realip_module --with-http_sub_module --with-http_ssl_module (注: --with-http_ssl_module:这个不加后面在nginx.conf配置ssl:on后,启动会报nginx: [emerg] unknown directive "ssl" in /opt/nginx/conf/nginx.conf 异常) $ make && make install
Start nginx
$ /usr/local/nginx/sbin/nginx
Step 6: Check whether the startup is successful
Open the browser to access the IP of this machine. If the browser displays welcome to nginx!, it means that nginx has been installed and run successfully.
Record what I encountered during this process:
Proceed In the sixth step, the connection to the browser was unsuccessful and there was no response, so I checked whether port 80 of the firewall was opened.
The command is:
firewall- cmd --list-all Check port 80
firewall-cmd --zone=public --add-port=80/tcp If port 80 is not open, open port 80
firewall- cmd --reload Reopen the firewall
Restart the nginx service again:
/usr/local/nginx/sbin/nginx –s reload
It is found that it still cannot connect to this IP address, check whether the local connection is normal:
The command is:
curl localhost
As shown in the picture, it is found that the local connection is successful, but the ip cannot be accessed
Finally, I checked and found that it was because of the new server. The Alibaba Cloud security group only opened ports 22 and 3389, but did not open port 80.
Only these two port numbers are not enough. In order to be able to connect to the server, port 80 needs to be opened.
Add the configuration rules of the security group
Since we are using Alibaba Cloud, we use Alibaba Cloud's security group operations to achieve the port opening effect.
After logging in to Alibaba Cloud, select in the following order: Cloud Server ecs->Security Group->Configuration Rules
Add port 80
As shown in the picture only Two modifications need to be made: Port range: 21/21 means starting from 21 and ending at 21Authorization object: 0.0.0.0/0 means that all IP addresses can access the portThe above is the detailed content of How to configure nginx in centos server. For more information, please follow other related articles on the PHP Chinese website!

Diagnosis and solutions for common errors of Nginx include: 1. View log files, 2. Adjust configuration files, 3. Optimize performance. By analyzing logs, adjusting timeout settings and optimizing cache and load balancing, errors such as 404, 502, 504 can be effectively resolved to improve website stability and performance.

NGINXUnitischosenfordeployingapplicationsduetoitsflexibility,easeofuse,andabilitytohandledynamicapplications.1)ItsupportsmultipleprogramminglanguageslikePython,PHP,Node.js,andJava.2)Itallowsdynamicreconfigurationwithoutdowntime.3)ItusesJSONforconfigu

NGINX can be used to serve files and manage traffic. 1) Configure NGINX service static files: define the listening port and file directory. 2) Implement load balancing and traffic management: Use upstream module and cache policies to optimize performance.

NGINX is suitable for handling high concurrency and static content, while Apache is suitable for dynamic content and complex URL rewrites. 1.NGINX adopts an event-driven model, suitable for high concurrency. 2. Apache uses process or thread model, which is suitable for dynamic content. 3. NGINX configuration is simple, Apache configuration is complex but more flexible.

NGINX and Apache each have their own advantages, and the choice depends on the specific needs. 1.NGINX is suitable for high concurrency, with simple deployment, and configuration examples include virtual hosts and reverse proxy. 2. Apache is suitable for complex configurations and is equally simple to deploy. Configuration examples include virtual hosts and URL rewrites.

The purpose of NGINXUnit is to simplify the deployment and management of web applications. Its advantages include: 1) Supports multiple programming languages, such as Python, PHP, Go, Java and Node.js; 2) Provides dynamic configuration and automatic reloading functions; 3) manages application lifecycle through a unified API; 4) Adopt an asynchronous I/O model to support high concurrency and load balancing.

NGINX started in 2002 and was developed by IgorSysoev to solve the C10k problem. 1.NGINX is a high-performance web server, an event-driven asynchronous architecture, suitable for high concurrency. 2. Provide advanced functions such as reverse proxy, load balancing and caching to improve system performance and reliability. 3. Optimization techniques include adjusting the number of worker processes, enabling Gzip compression, using HTTP/2 and security configuration.

The main architecture difference between NGINX and Apache is that NGINX adopts event-driven, asynchronous non-blocking model, while Apache uses process or thread model. 1) NGINX efficiently handles high-concurrent connections through event loops and I/O multiplexing mechanisms, suitable for static content and reverse proxy. 2) Apache adopts a multi-process or multi-threaded model, which is highly stable but has high resource consumption, and is suitable for scenarios where rich module expansion is required.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

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.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
