分成更小的单元
This commit is contained in:
33
utils/nginx.sh
Normal file
33
utils/nginx.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Install nginx
|
||||
echo "Installing nginx..."
|
||||
|
||||
echo "[nginx]
|
||||
name=nginx repo
|
||||
baseurl=http://nginx.org/packages/centos/\$releasever/\$basearch/
|
||||
gpgcheck=0
|
||||
enabled=1" > /etc/yum.repos.d/nginx.repo
|
||||
|
||||
# Install Nginx
|
||||
echo "Installing Nginx..."
|
||||
sudo yum install -y nginx
|
||||
|
||||
# Configure Nginx for PHP
|
||||
echo "Configuring Nginx for PHP..."
|
||||
IP=`curl -4 ip.llm.me`
|
||||
sudo cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
|
||||
sudo cp /etc/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf.bak
|
||||
sudo cp `${SCRIPT_ROOT}/conf/nginx.conf` /etc/nginx/nginx.conf
|
||||
sudo cp `${SCRIPT_ROOT}/conf/default.conf` /etc/nginx/conf.d/default.conf
|
||||
sudo sed -i "s/localhost/$IP `hostname`/g" /etc/nginx/conf.d/default.conf
|
||||
|
||||
echo "Configuring Firewall..."
|
||||
sudo /sbin/iptables -I INPUT -p tcp --dport 443 -j ACCEPT
|
||||
sudo /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
|
||||
sudo /sbin/service iptables save
|
||||
sudo systemctl restart iptables
|
||||
|
||||
echo "Install and start service..."
|
||||
sudo systemctl restart nginx.service
|
||||
sudo systemctl enable nginx.service
|
||||
Reference in New Issue
Block a user