In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Today, I will talk to you about how to configure nginx in the centos server, many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
Download the secure terminal MobaXterm_Personal
First, after downloading the security terminal, connect to your own public network IP
After the connection is successful, it is shown as above.
Introduction to Nginx
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 reverse proxy service
After connecting to the server
Step 1: install gcc gcc-c++
The command is:
Yum install-y gcc gcc-c++
Step 2: install the PCR 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 you report an error: configure: error: You need a C++ compiler for C++ support
Solution: yum install-y gcc gcc-c++
Step 3: install the 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 (note:-- with-http_ssl_module: this is not followed after nginx.conf configures ssl:on Startup will report nginx: [emerg] unknown directive "ssl" in / opt/nginx/conf/nginx.conf exception) $make & & make install
Start nginx
$/ usr/local/nginx/sbin/nginx
Step 6: check whether the startup is successful
Open a browser to access the IP of this machine, if the browser appears Welcome to nginx! Then Nginx is installed and running successfully.
Record what happened to me in the process:
At step 6, the connection to the browser was unsuccessful and there was no response, so I checked whether port 80 of the firewall was open.
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 reopens the firewall
Restart the nginx service again:
/ usr/local/nginx/sbin/nginx-s reload
Found or unable to connect to this IP address, check that the local connection is normal:
The command is:
Curl localhost
Displayed as a picture, it is found that the local connection is successful, but ip just cannot access it.
Finally, it was found that because of the new server, Aliyun Security Group only opened ports 22 and 3389, but did not open port 80.
Only these two port numbers are not enough, and port 80 needs to be opened in order to link to the server.
Add configuration rules for security groups
Since Aliyun is used, we will use the security group operation of Aliyun to achieve the opening effect of the port.
After logging in to Ali Cloud, select in the following order: CVM ECS- > Security Group-> configuration rules
At present, there are three security group rules, which are 22prime3389 and ICMP protocol.
Then click add Security Group Rule in the upper right corner
Add port 80
As shown in the figure, you only need to modify two:
Port range: 21: 21 indicates that it starts at 21 and ends at 21.
Authorization object: 0.0.0.0 ip 0 means that all port addresses can access the port
As shown in the figure, a new rule has been added
After reading the above, do you have any further understanding of how to configure nginx in the centos server? If you want to know more knowledge or related content, 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.