@@ -119,4 +119,73 @@ http {
119119 }
120120
121121 }
122+
123+ server {
124+
125+ listen 81 proxy_protocol ;
126+ server_name ~ ^[a-z0-9]+\.onion$;
127+
128+ root /src/www;
129+ index index .php;
130+
131+ real_ip_header proxy_protocol ;
132+ real_ip_recursive on;
133+
134+ # local
135+ set_real_ip_from 192.168.0.0 /16 ;
136+ set_real_ip_from 172.16.0.0 /12 ;
137+ set_real_ip_from 10.0.0.0 /8;
138+ set_real_ip_from fc00::/7;
139+
140+ client_max_body_size 5m ;
141+ client_body_timeout 60 ;
142+
143+ # Add CORS headers globally
144+ add_header 'Access-Control-Allow-Origin' '*' ;
145+ add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' ;
146+ add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Content-Range,Range' ;
147+
148+ location ~ ^/( socket\.io|broadcast)/ {
149+
150+ proxy_pass http ://127.0.0.1:9393 ;
151+ proxy_http_version 1.1;
152+ proxy_set_header Host $host ;
153+ proxy_set_header X-Real-IP $remote_addr ;
154+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
155+ proxy_set_header Upgrade $http_upgrade ;
156+ proxy_set_header Connection "Upgrade" ;
157+ proxy_connect_timeout 7d ;
158+ proxy_send_timeout 7d ;
159+ proxy_read_timeout 7d ;
160+
161+ }
162+
163+ location / {
164+
165+ if ( !-e $request_filename ) {
166+ rewrite ^( /.*) $ /index .php?q=$1 last;
167+ break ;
168+ }
169+
170+ }
171+
172+ location ~ \.php$ {
173+
174+ include /etc/nginx/fastcgi_params;
175+ fastcgi_intercept_errors on;
176+ fastcgi_index index .php;
177+ fastcgi_pass localhost:9000 ;
178+ fastcgi_param SCRIPT_FILENAME $request_filename ;
179+
180+ }
181+
182+ location ~ * ^( ?!.*socket\.io\.js).*\.(js|css|png|jpg|jpeg|gif|ico)$ {
183+
184+ try_files $uri /index .php;
185+ expires max;
186+ log_not_found off;
187+
188+ }
189+
190+ }
122191}
0 commit comments