From fda561084f8d68e25e98a06af32b57ff04e0d82c Mon Sep 17 00:00:00 2001 From: x Date: Sun, 14 Sep 2025 00:50:59 +0200 Subject: [PATCH] [W0-2] fixing nginx reverse proxy configuration --- README.md | 25 +++++++++++++++-- conf/nginx/nginx_w0bm.conf | 57 ++++++++++++++++---------------------- 2 files changed, 47 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index f9d85ca..1c87bac 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ First of all put a .webm file named 1.webm in `w0bm-data/b` `php7.1 artisan tags` -Now visit http://localhost:8080 +Now visit http://localhost:8090 To get upload working do this @@ -38,4 +38,25 @@ root@703c9472fed5:/opt/w0bm/public# chmod -R 777 thumbs/ root@703c9472fed5:/opt/w0bm/public# chmod -R 777 b ``` -inside the container, it applied to the mount \ No newline at end of file +inside the container, it applied to the mount + +# Reverse Proxy + +nginx + +`url = foo.bar` + +``` +server { + server_name $url; + … + location / { + proxy_pass http://localhost:8090; + proxy_set_header Host $url; + proxy_set_header X-Forwarded-Proto $scheme; + sub_filter 'http://' 'https://'; + sub_filter_types *; + sub_filter_once off; + } +} +``` \ No newline at end of file diff --git a/conf/nginx/nginx_w0bm.conf b/conf/nginx/nginx_w0bm.conf index 8dcc6eb..30d3827 100644 --- a/conf/nginx/nginx_w0bm.conf +++ b/conf/nginx/nginx_w0bm.conf @@ -1,43 +1,34 @@ + #w0bm.com server { - server_name w0bm.local; + server_name _; listen 8090; - #listen [::]:8443 ssl proxy_protocol; - http2 on; root /opt/w0bm/public; - - allow all; - index index.php; - try_files $uri $uri/ /index.php?$args; - access_log off; client_max_body_size 500M; - #add_header 'Access-Control-Allow-Origin' '*'; - location = /database/cNsH4YbaKtwQWsKQk47LVAEJTyt3yi6Cz2npPF9izxJ8q7GWg.php { - auth_basic "Restricted Area"; - auth_basic_user_file /etc/nginx/.htpasswd; -fastcgi_split_path_info ^(.+\.php)(/.+)$; -include fastcgi_params; -fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; -fastcgi_pass unix:/run/php/php7.1-fpm.sock; - } + location ~ \.php$ { + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_index index.php; + include fastcgi.conf; + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name; + #fastcgi_param GEOIP_ADDR $remote_addr; + #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_pass unix:/run/php/php7.1-fpm.sock; + } + location ~* \.(?:css|js)$ { + gzip on; + expires 1y; + add_header Cache-Control "public"; + } + location ~* \.(?:jpg|jpeg|gif|png|ico|svg)$ { + expires 1M; + access_log off; + add_header Cache-Control "public"; + } + location / { + try_files $uri $uri/ /index.php?$args; + } - location /api/video/upload { - client_max_body_size 500M; - fastcgi_param PHP_VALUE "upload_max_filesize=500M \n post_max_size=500M"; -fastcgi_split_path_info ^(.+\.php)(/.+)$; -include fastcgi_params; -fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; -fastcgi_pass unix:/run/php/php7.1-fpm.sock; - fastcgi_param SCRIPT_FILENAME $document_root/index.php; - } - - location /index.php { -fastcgi_split_path_info ^(.+\.php)(/.+)$; -include fastcgi_params; -fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; -fastcgi_pass unix:/run/php/php7.1-fpm.sock; - } } \ No newline at end of file