first commit
This commit is contained in:
103
1_setup_local_dns.sh
Executable file
103
1_setup_local_dns.sh
Executable file
@@ -0,0 +1,103 @@
|
||||
sudo apt install -y nginx
|
||||
|
||||
|
||||
|
||||
# sudo nano /etc/nginx/sites-available/lan-proxy.conf
|
||||
# {
|
||||
|
||||
# server {
|
||||
# listen 443 ssl;
|
||||
# server_name github.generalinfinity.cloud;
|
||||
# ssl_certificate /etc/nginx/local.crt;
|
||||
# ssl_certificate_key /etc/nginx/local.key;
|
||||
# location / {
|
||||
# proxy_pass http://192.168.1.203:3100;
|
||||
# proxy_set_header Host $host;
|
||||
# proxy_set_header X-Real-IP $remote_addr;
|
||||
# proxy_set_header Upgrade $http_upgrade;
|
||||
# proxy_set_header Connection $connection_upgrade;
|
||||
# }
|
||||
# }
|
||||
|
||||
# server {
|
||||
# listen 443 ssl;
|
||||
# server_name call.generalinfinity.cloud;
|
||||
# ssl_certificate /etc/nginx/local.crt;
|
||||
# ssl_certificate_key /etc/nginx/local.key;
|
||||
# location / {
|
||||
# proxy_pass http://192.168.1.202:3000;
|
||||
# proxy_set_header Host $host;
|
||||
# proxy_set_header X-Real-IP $remote_addr;
|
||||
# proxy_set_header Upgrade $http_upgrade;
|
||||
# proxy_set_header Connection $connection_upgrade;
|
||||
# }
|
||||
# }
|
||||
|
||||
|
||||
# }
|
||||
|
||||
sudo tee /etc/nginx/sites-available/lan-proxy.conf > /dev/null << 'EOF'
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name github.generalinfinity.cloud;
|
||||
ssl_certificate /etc/nginx/local.crt;
|
||||
ssl_certificate_key /etc/nginx/local.key;
|
||||
|
||||
location / {
|
||||
proxy_pass http://192.168.1.203:3100;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl;
|
||||
server_name call.generalinfinity.cloud;
|
||||
ssl_certificate /etc/nginx/local.crt;
|
||||
ssl_certificate_key /etc/nginx/local.key;
|
||||
|
||||
location / {
|
||||
proxy_pass http://192.168.1.202:3000;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
sudo openssl req -x509 -nodes -newkey rsa:2048 \
|
||||
-keyout /etc/nginx/local.key -out /etc/nginx/local.crt -days 365 \
|
||||
-subj "/CN=github.generalinfinity.cloud" \
|
||||
-addext "subjectAltName=DNS:github.generalinfinity.cloud,DNS:call.generalinfinity.cloud"
|
||||
|
||||
|
||||
|
||||
sudo nginx -t && sudo systemctl restart nginx
|
||||
|
||||
|
||||
|
||||
|
||||
# optional
|
||||
sudo ufw allow "Nginx Full"
|
||||
|
||||
|
||||
|
||||
# 1) Fix hosts (remove bad line, add correct one)
|
||||
sudo sed -i '/NGINX_IP/d' /etc/hosts
|
||||
echo "192.168.1.202 github.generalinfinity.cloud call.generalinfinity.cloud" | sudo tee -a /etc/hosts
|
||||
# 2) Test Nginx vhost routing
|
||||
curl -I -H 'Host: github.generalinfinity.cloud' http://192.168.1.202/
|
||||
curl -I -H 'Host: call.generalinfinity.cloud' http://192.168.1.202/
|
||||
Reference in New Issue
Block a user