commit fad3139c68a107cad26a74033c511e488e6a0cb1 Author: Fabio Date: Wed Feb 5 22:45:49 2025 +0800 first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..fa2d9ba --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +# NGINX + +installare con il volume /home/nvme/dockerdata/nginx:/etc/nginx1 + +```docker-compose +services: + mynginx: + image: nginx + restart: always + volumes: + - /home/nvme/dockerdata/nginx/html:/usr/share/nginx/html:ro + - /home/nvme/dockerdata/nginx:/etc/nginx1 #da modificare senza l'1 dopo aver copiato tutto + ports: + - "80:80" + - "443:443" + networks: + - fabio + +networks: + fabio: + external: true +``` + +entrare nel bash del docker e copiare tutto /etc/nginx in /etc/nginx1 +```bash +cp -R /etc/nginx in /etc/nginx1 +``` + +uscire dal docker + +stoppare il docker + +modificare la riga del docker-compose togliendo l'1 +```docker-compose +/home/nvme/dockerdata/nginx:/etc/nginx +``` + +far ripartire il docker + +in /home/nvme/dockerdata/nginx/conf.d iserire i vari files di config + + diff --git a/conf.d_files/default.conf b/conf.d_files/default.conf new file mode 100644 index 0000000..554b8f6 --- /dev/null +++ b/conf.d_files/default.conf @@ -0,0 +1,45 @@ +server { + listen 80; + listen [::]:80; + server_name patachina.casacam.net; + + #access_log /var/log/nginx/host.access.log main; + + location / { + root /usr/share/nginx/html; + index index.html index.htm; + } + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root /usr/share/nginx/html; + } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + #location ~ \.php$ { + # root html; + # fastcgi_pass 127.0.0.1:9000; + # fastcgi_index index.php; + # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; + # include fastcgi_params; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} +} + diff --git a/conf.d_files/forgejo.conf b/conf.d_files/forgejo.conf new file mode 100644 index 0000000..fb2ad38 --- /dev/null +++ b/conf.d_files/forgejo.conf @@ -0,0 +1,19 @@ +server { + listen 80; # Listen on IPv4 port 80 + listen [::]:80; # Listen on IPv6 port 80 + + server_name forgit.patachina.casacam.net; # Change this to the server domain name. + + location / { + proxy_pass http://192.168.1.4:3100; # Port 3000 is the default Forgejo port + + proxy_set_header Connection $http_connection; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + client_max_body_size 512M; + } +} diff --git a/conf.d_files/forgejossl.conf b/conf.d_files/forgejossl.conf new file mode 100644 index 0000000..0965b29 --- /dev/null +++ b/conf.d_files/forgejossl.conf @@ -0,0 +1,22 @@ +server { + listen 443 ssl; + listen [::]:443 ssl; + + server_name forgit.patachina.casacam.net; # Change this to the server domain name. + + ssl_certificate ssl/live/npm-9/fullchain1.pem; + ssl_certificate_key ssl/live/npm-9/privkey1.pem; + + location / { + proxy_pass http://192.168.1.4:3100; # Port 3000 is the default Forgejo port + + proxy_set_header Connection $http_connection; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + client_max_body_size 512M; + } +} diff --git a/conf.d_files/ha.conf b/conf.d_files/ha.conf new file mode 100644 index 0000000..124f9af --- /dev/null +++ b/conf.d_files/ha.conf @@ -0,0 +1,29 @@ +server { + #listen 443 ssl; + listen 80; + server_name ha.patachina.casacam.net; + + #ssl on; + #ssl_certificate /etc/nginx/ssl/home.example.org/home.example.org-bundle.crt; + #ssl_certificate_key /etc/nginx/ssl/home.example.org/home.example.org.key; + #ssl_prefer_server_ciphers on; + + location / { + proxy_pass http://192.168.1.4:8123; + proxy_set_header Host $host; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + } + + location /api/websocket { + proxy_pass http://192.168.1.4:8123/api/websocket; + proxy_set_header Host $host; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + + } +} diff --git a/conf.d_files/portainer.conf b/conf.d_files/portainer.conf new file mode 100644 index 0000000..db5de3f --- /dev/null +++ b/conf.d_files/portainer.conf @@ -0,0 +1,19 @@ +server { + listen 80; # Listen on IPv4 port 80 + listen [::]:80; # Listen on IPv6 port 80 + + server_name portainer.patachina.casacam.net; # Change this to the server domain name. + + location / { + proxy_pass http://192.168.1.4:9000; # Port 3000 is the default Forgejo port + + proxy_set_header Connection $http_connection; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + client_max_body_size 512M; + } +} diff --git a/conf.d_files/portainerssl.conf b/conf.d_files/portainerssl.conf new file mode 100644 index 0000000..ba5be1d --- /dev/null +++ b/conf.d_files/portainerssl.conf @@ -0,0 +1,22 @@ +server { + listen 443 ssl; + listen [::]:443 ssl; + + server_name portainer.patachina.casacam.net; # Change this to the server domain name. + + ssl_certificate ssl/live/npm-9/fullchain1.pem; + ssl_certificate_key ssl/live/npm-9/privkey1.pem; + + location / { + proxy_pass http://192.168.1.4:9000; # Port 3000 is the default Forgejo port + + proxy_set_header Connection $http_connection; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + client_max_body_size 512M; + } +}