In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you how to build nginx web services on Alibaba Cloud Centos7 server. The content is simple and easy to understand. I hope you can learn it. After learning, there will definitely be gains. Let's take a look at it together.
(1) After purchasing Centos7 server, be sure to enter the security group rules of Alibaba Cloud's management console, enter the direction, add security group rules, open port 80, and fill in 0.0.0/0 for authorized objects to authorize all ipv4 addresses. Remember, I just didn't do this, and then all kinds of firewalls opened port 80, and then the browser has been unable to access.
(2) Download and install Nginx:
Download:
wget -c https://nginx.org/download/nginx-1.10.1.tar.gz
Install nginx dependencies:
Install gcc (usually comes with it, no need to install):
yum install gcc-c++ #Note: gcc -v Check if gcc version is installed
Install pcre pcre-devel:
yum install -y pcre pcre-devel
Install zlib zlib-devel:
yum install -y zlib zlib-devel
Install OpenSSL:
yum install -y openssl openssl-devel
Decompress:
tar -zxvf nginx-1.10.1.tar.gz
Compile and install:
cd nginx-1.10.1./ configure --prefix=/usr/local/nginx #(can customize other configuration options) makemake install
(3) Open port 80 of the firewall
Under centos7, the firewall no longer uses/etc/sysconfig/iptables, but firewall.
1. Check whether port 80 is open:
firewall-cmd --query-port=80/tcp
FirewallD is not running.
Indicates agnostic firewall, needs to check status and turn on firewall
2. View firewall status:
systemctl status firewalld
running status means the firewall is open
Dead state means firewall is not open
3. Open firewall:
systemctl start firewalld
4. Open Permanent Port Number 80:
firewall-cmd --add-port=80/tcp --permanent
5. Reload configuration:
firewall-cmd --reload
6. Check again if the open port is open:
firewall-cmd --query-port=666/tcp
Yes means success.
(4) Start nginx:
cd /usr/local/nginx
The configuration file can be modified as needed./ conf/nginx.conf (note to make a backup before modification to prevent correction)
cd sbin
Start according to profile:
./ nginx -c /usr/local/nginx/conf/nginx.conf
Check if nginx starts successfully:
ps aux | grep nginx
(5) Enter the corresponding server IP in the browser and the welcome to nginx interface will appear.
The above is about how to build nginx web services on Alibaba Cloud Centos7 server. If you have learned knowledge or skills, you can share it for more people to see.
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.