-
Notifications
You must be signed in to change notification settings - Fork 10
/
nginx.conf
executable file
·33 lines (28 loc) · 1.23 KB
/
nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
if ! which nginx > /dev/null 2>&1; then
echo "Nginx not installed"
else
echo
fi
CONF_FILE=/etc/nginx/sites-enabled/youtube-audio.conf
sudo rm -rf $CONF_FILE
sudo touch $CONF_FILE
sudo bash -c 'echo "server {" >>'$CONF_FILE
sudo bash -c 'sudo echo " listen 80;" >>'$CONF_FILE
sudo bash -c 'sudo echo " root "$(pwd)"/dist;" >>'$CONF_FILE
sudo bash -c 'sudo echo " location / {" >>'$CONF_FILE
sudo bash -c 'sudo echo " rewrite ^/(.*)$ /\$1.mp3 break;" >>'$CONF_FILE
sudo bash -c 'sudo echo " }" >>'$CONF_FILE
sudo bash -c 'sudo echo " location /api {" >>'$CONF_FILE
sudo bash -c 'sudo echo " rewrite ^/api / break;" >>'$CONF_FILE
sudo bash -c 'sudo echo " proxy_pass http://127.0.0.1:8888;" >>'$CONF_FILE
sudo bash -c 'sudo echo " proxy_set_header X-Real-IP \$remote_addr;" >>'$CONF_FILE
sudo bash -c 'sudo echo " proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;" >>'$CONF_FILE
sudo bash -c 'sudo echo " proxy_set_header Host \$http_host;" >>'$CONF_FILE
sudo bash -c 'sudo echo " proxy_set_header X-NginX-Proxy true;" >>'$CONF_FILE
sudo bash -c 'sudo echo " }" >>'$CONF_FILE
sudo bash -c 'sudo echo "}" >>'$CONF_FILE
sudo service nginx restart
echo "************"
echo "Done!"
echo "************"