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
##The current security group rule is 3 They are 22, 3389 and icmp protocols respectively. Then click Add Security Group Rules in the upper right cornerAdd 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 port As shown in the picture, a new rule has been addedThe 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!