Nginx Installation and Deployment
Opening Specified Ports or Disabling Firewall
View the ports that are already open:
firewall-cmd --list-ports
Open a specified port (e.g., port 80 for Nginx):
firewall-cmd --zone=public --add-port=80/tcp --permanent
Reload the firewall configuration:
firewall-cmd --reload
Confirm the opened ports:
firewall-cmd --list-ports
If needed, you can stop the firewall:
systemctl stop firewalld
Check the firewall status:
systemctl status firewalld
Installation and Deployment
Extract the Nginx installation package:
tar -zxvf nginx-1.16.1.tar.gz -C /usr/local/
Install dependencies:
yum install -y pcre pcre-devel yum install -y zlib zlib-devel
Configure the installation path:
cd /usr/local/nginx-1.16.1 ./configure --prefix=/usr/local/nginx
Compile Nginx:
make && make install
Configure local hostname resolution: Edit
/etc/hosts
and add an entry for your local domain:ip cloud.whalealmg.com
Edit the Nginx configuration file:
server { listen 80; server_name cloud.whalealmg.com; location / { root /usr/local/nginx/html/dist/; index index.html index.htm; try_files $uri $uri/ /index.html; } location /filingAdmin/ { proxy_pass http://127.0.0.1:8000/; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Port $server_port; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } location ~ .*\.(js|css|jpg|jpeg|gif|png|ico|pdf|txt)$ { root /usr/local/nginx/html/dist/; index index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }
Start the Nginx service:
/usr/local/nginx/sbin/nginx
Make sure to adjust paths, domain names, and other configurations as needed for your specific environment.