mirror of https://gitlab.com/hp3icc/emq-TE1.git
62 lines
1.5 KiB
Bash
62 lines
1.5 KiB
Bash
#!/bin/bash
|
|
# Nombre del script
|
|
SCRIPT_NAME="nginx.sh"
|
|
|
|
# Registra el inicio en /opt/curl.txt
|
|
echo "Inicio: $SCRIPT_NAME" >> /opt/curl.txt
|
|
if [ ! -f "/etc/nginx/sites-available/000" ]; then
|
|
sudo apt-get install nginx php-fpm -y
|
|
fi
|
|
if [ -f "/etc/nginx/sites-enabled/default" ]; then
|
|
rm /etc/nginx/sites-enabled/default
|
|
fi
|
|
if [ -f "/etc/nginx/sites-enabled/000" ]; then
|
|
rm /etc/nginx/sites-enabled/000
|
|
fi
|
|
sudo systemctl restart nginx
|
|
sudo systemctl enable nginx
|
|
sudo cat > /etc/nginx/sites-available/000 <<- "EOFX1"
|
|
server {
|
|
listen wd0p;
|
|
|
|
|
|
root w0d0;
|
|
index index.php index.html index.htm;
|
|
|
|
#server_name _;
|
|
|
|
location / {
|
|
try_files $uri $uri/ /index.php?$args;
|
|
}
|
|
|
|
location ~ \.php$ {
|
|
include snippets/fastcgi-php.conf;
|
|
fastcgi_pass unix:/var/run/php/php-fpm.sock;
|
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
|
include fastcgi_params;
|
|
}
|
|
|
|
error_page 404 /404.html;
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
}
|
|
|
|
EOFX1
|
|
sudo cat > /etc/nginx/sites-available/proxy0 <<- "EOFX1"
|
|
server {
|
|
listen wd0p;
|
|
server_name w0dn0;
|
|
|
|
location / {
|
|
proxy_pass http://127.0.0.1:wp0p;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
}
|
|
}
|
|
EOFX1
|
|
################################################################
|
|
# Registra el final en /opt/curl.txt
|
|
echo "Finalizado: $SCRIPT_NAME" >> /opt/curl.txt
|