Quantcast
Channel: Nginx Forum - How to...
Viewing all 2931 articles
Browse latest View live

Reverse proxy if target server does redirect (no replies)

$
0
0
Hi all,
I want to have Nginx as reverse proxy into my smart home.
E.g. the location home shall reverse proxy my Homematic system:

location /home/ {
proxy_pass http://192.168.23.120/;
}

What the target (which I reach nicely) does is forward to /pages/index.htm?<sessionID>

Nginx converts that to http://my_nginx_server/pages/index.htm?<sessionID> -> where I get a 404 (which is correct ;-) )

-->how do I have to setup Nginx that it creates http://my_nginx_server/home/pages/index.htm?<sessionID>
-->how can I tell Nginx to proxy a whole substructure of a target server?

Thanks in advance,
Ben

HTTP to HTTPS doesn't work to Angular app (no replies)

$
0
0
I want to make a redirect HTTP to HTTPS with proxy to my Angular app. The HTTP > HTTPS redirect works, but later this the ssl proxy can't reach the Angular app on localhost:4200.

When I set to 80 port only it works.

I also tried to put both with the same server names, proxy in the both servers, etc...

"server {
listen 80;
return 301 https://$host$request_uri;
}

server {

listen 443;
server_name example.com;

ssl_certificate /etc/nginx/ssl/example.com.crt;
ssl_certificate_key /etc/nginx/ssl/example.com.key;

ssl on;
ssl_session_cache builtin:1000 shared:SSL:10m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;

access_log /var/log/nginx/site.access.log;

location / {

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;

# Fix the “It appears that your reverse proxy set up is broken" error.
proxy_pass http://localhost:4200;
proxy_read_timeout 90;
proxy_redirect http://localhost:4200 https://example.com;
}
}"

Need help fixing http to https on LEMP (no replies)

$
0
0
Need help setting up 301 redirects from http to https on the following config.

Enabling return 301 https://dom1.com$request_uri; line makes too many redirects. A also tried 2 server blocks with one for 80 2nd for 443 same error.

Here is my config for vhost file:

server {
listen 80;
listen 443 ssl http2;
server_name dom1.com www.dom1.com;
# return 301 https://dom1.com$request_uri;



pagespeed off;

# use any of the following two
real_ip_header CF-Connecting-IP;

#Root Folder
root www/dom1.com;

ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS;
ssl_buffer_size 8k;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:50m;
ssl_session_timeout 30m;

#ssl_certificate /var/lib/acme/live/dom1.com/fullchain;
ssl_certificate /var/lib/acme/live/dom1.com/fullchaini_new;
#ssl_certificate_key /var/lib/acme/live/dom1.com/privkey;
ssl_certificate_key /var/lib/acme/live/dom1.com/privkey_new;

ssl_dhparam /usr/local/nginx/conf.d/dhparams.pem;

ssl_stapling on;
resolver 8.8.8.8;
ssl_stapling_verify on;
ssl_trusted_certificate /var/lib/acme/live/dom1.com/fullchain;

location / {
index index.php index.html;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
include /usr/local/nginx/www/dom1.com/nginx.conf;

#Static Files Caching
location ~ \.(css|less|js|gif|png|jpeg|jpg|ico|woff|woff2)$ {
expires 31536000s;
add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public";
}



location ~ \.php$ {
try_files $uri =404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /usr/local/nginx/conf/fastcgi_params;
}

}

IMAP and POP3 upstream session keepalive (no replies)

$
0
0
Hi!

We are setting up an Nginx mail proxy to seamless migrate from Cyrus to Dovecot. We used this documentation to implement it: https://docs.nginx.com/nginx/admin-guide/mail-proxy/mail-proxy/
Currently, we are only using Cyrus behind the proxy but are encountering an issue with the number of IMAP connections from Nginx to Cyrus because they are left open until Nginx is restarted.

We are wondering now if we can set a keepalive timeout for the upstream connections. For HTTP upstreams there is the `keepalive` setting but I was not able to locate a similar setting for mail.

Does anyone know how to adjust this to not have thousands of open IMAP and POP3 connections?

Thanks for any hint on that.

Best regards!

Subdomain not working (1 reply)

$
0
0
Hi,

I what to setup three domain in my nginx server running on linux and I am getting into some issues basically
the subdomain is not working

myserver.com
platform.myserver.com
www.myserver.com

The following is what I had done

1. Installed nginx and tested it works fine
2. when to /etc/nginx/sites-available/
3. Copied /etc/nginx/sites-available/default file to /etc/nginx/sites-available/myserver.com
4. Then created a link in /etc/nginx/sites-enabled/myserver.com
The contents of myserver looks as follows

server {
listen 80 ;
listen [::]:80 ;
root /var/www/myserver.com;
index myserver.html
server_name myserver.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}

5. Renamed the file default in /etc/nginx/sites-available/ to so default.xxx (practically deleted)

With this I am able to access http://myserver.com from any where in the internet.
I can see the contents stored in /var/www/myserver.com. So far all good.

6. I need to enable the second subdomain platform.myserver.com. I followed the above steps for platform

7. Copied /etc/nginx/sites-available/default file to /etc/nginx/sites-available/platform.myserver.com

8. Then created a link in /etc/nginx/sites-enabled/platform.myserver.com
The contents of platform.myserver.com is given below
server {
listen 80 ;
listen [::]:80 ;
root /var/www/platform;
index platform.html
server_name platform.myserver.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}

I had copied different content into root /var/www/platform

Now I had tried to access platform.myserver.com

The problem the server is going to the same root folder of /var/www/myserver.com and showing the contents
instead of showing the contents from /var/www/platform

Can you give me some clues or tips to debug this issue. Not able to figure out the issue here.

Regards
Girish

SMTP With Postfix Behind Nginx R-PROXY (no replies)

$
0
0
Hello All,

i try to configure my infrastructure, with my servers in Trusted Network, and Nginx Proxy in DMZ.
Until now for http, https and some stream working perfectly.

Also i configure and working imap stream, then i can reach, autenticate and sync my mails.

Problem arrive when i try to configure SMTP with postfix.
I try with mail {} or with stream {}.

Connection arrive to my server, and mail also arrive, but my server put all email in junk, that because in log i can see Nginx proxy change source IP with his.

Some one had same problem? It's possible to configure stream {} or mail {} with real source ip?

Thank you

Alex

"No rule to make target" on make (no replies)

$
0
0
Hi,
i'm new here and also just take my first steps with Nginx-Module-Programming.

Last week I've create my first Test following this:
https://blog.csdn.net/xiangguiwang/article/details/70174908

and all works.
Today i've changed the cpp-File a little bit and tried again.
The Configuration runs without a Problem, but when i use "make" it says:

make[1]: *** No rule to make target '/home/user1/test//ngx_http_hello_world_module.cpp', needed by 'objs/addon/test/ngx_http_hello_world_module.o'. Stop.

Then i delete all and create the first (hello_world from the site above) again, but also with the same result.
The module-Cpp is an exact copy of the hello_world and the config contains the following:

ngx_addon_name=ngx_http_hello_world_module
HTTP_MODULES="$HTTP_MODULES ngx_http_hello_world_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_hello_world_module.cpp"

Can anyone tell me, what's going on now?

non-www to www only (2 replies)

$
0
0
An SEO tool I am using has made this suggestion:

Quote:
Some websites have www in front of their domain, like www.google.com. Others don't, like dribbble.com.

If your website works on the domain www and the one without, you have two identical websites on a different URL. Google will consider that duplicate, and lower your rankings.

There's an easy fix: redirect all your traffic to www. If you have an Apache server, add this to your .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

However, I am using Nginx and not Apache so that "easy fix" isn't applicable to me. Here is my config file for Nginx:

Link: https://pastebin.com/zsKbtawz

Any assistance would be greatly appreciated.

Trace ID (no replies)

$
0
0
Hello,

I have a radio streaming where I use nginx to proxy this stream what I am trying to do is add a variable to access log that keeps record of a listener without changing that variable through a session. What's the reason to do that? There are listeners in the same ip but different devices. I want to separate them and track the listeners like how long they listened the station. Is there a way to do that? Any help would be appreciated.

IIS rewrite to nginx rewrite (no replies)

$
0
0
Hello everyone -

I've been running a web site on IIS for years and have used the following rewrite rule to make it easier to access resources on my LAN. In this example, I'm able to type in plex.domain.com which hits IIS which rewrites the URL and sends me to the correct location including port number.

I'm switching ti nginx now and have tried many different configurations and following many different examples on the web on how to write this for nginx - but have had no luck.

Could someone point me in the right direction to accomplish this?

Thank you in advance for your assistance.


<rule name="plex" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(plex\.)(domain\.com.*)$" />
</conditions>
<action type="Redirect" url="http://192.168.0.2:32400/web/index.html#" />
</rule>

reverse proxy issue with websocket (no replies)

$
0
0
Hi,

i tried a little longer now with one of my services behind my reverse proxy and im out of ideas meanwhile.

i use several subdomains and subfolder configs wich are all working nice exept this one special service, may here someone has an idea.

Following error i see in the chrome dev console when i try to access the site behind the proxy.

Uncaught DOMException: Failed to construct 'WebSocket': The "https://web.meinedomain.de/web/js/network_ts.js" (wird angezeigt als Link network_ts.js:17) URL's scheme must be either 'ws' or 'wss'. 'undefinedweb.meinedomain.de' is not allowed.
at Server.request (https://web.meinedomain.de/web/js/network_ts.js:17:18)
at PageReady (https://web.meinedomain.de/web/js/menu_ts.js:671:12)
at onload (https://web.meinedomain.de/web/:20:57)

i ve tried severall suggestions while using google, ending always in the same trap ...

The service is called, always ends in a endless spinner (loading) splash ...

as sample my actual current last config, may someone has an idea what to try ... or is it like this that some services are just not capable to be served behind a reverse proxy without rewriting them.

For any hints, thanks ahead.

server {
listen 443 ssl;

# root /config/www;
# index index.html index.htm index.php;

server_name web.*;

ssl_certificate /config/keys/letsencrypt/fullchain.pem;
ssl_certificate_key /config/keys/letsencrypt/privkey.pem;
ssl_dhparam /config/nginx/dhparams.pem;
ssl_ciphers 'ECD........
ssl_prefer_server_ciphers on;

location / {
include /config/nginx/proxy.conf;
resolver 127.0.0.11 valid=30s;
set $upstream_xteve 192.168.1.2;
proxy_pass http://$upstream_xteve:34400;
}

location /api/websocket {
resolver 127.0.0.11 valid=30s;
set $upstream_xteve 192.168.1.2;
proxy_pass http://$upstream_xteve:34400;
proxy_set_header Host $host;

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}

Reverse Proxy Cookies (no replies)

$
0
0
Hi

I have domain tool.abc.com, when someone visit this domain I want to auto login user on a different domain e.g mytool.com. So is it possible to pass session cookies on nginx level and reverse proxy it to mytool.com with the cookies (e.g cookies of user1) ? or any other way to do it on web server level?

Nginx not serving images from Windows app (no replies)

$
0
0
Hi,

Let me start by saying I am very new to all of this, so please excuse my lack of knowledge.

I have Nginx running on ubuntu. I am using the reverse proxy feature to serve up web apps that run on different ports on my windows server. I am having an issue with images not being served. When a user goes to the domain, the page loads, but all images are gone. Here is the error message from the nginx log:
2019/07/08 10:50:20 [crit] 29174#29174: *5662 open() "/var/lib/nginx/proxy/2/80/0000001802" failed (13: Permission denied) while reading upstream, client: 174.226.9.250, server: mysub.mydomain.net, request: "GET /444348088AC3FC45BA2BB94B5092E514F715451C/styles.css HTTP/1.1", upstream: "http://192.168.1.50:8008/444348088AC3FC45BA2BB94B5092E514F715451C/styles.css", host: "mysub.mydomain.net", referrer: "https://mysub.mydomain.net/"

I have attached copies of the conf files. I had some help writing the conf files, however the person that helped me is stumped as well.

Thanks

nginx keep requesting backend tomcat servers repeatedly (no replies)

$
0
0
I have a nginx plus Load balancing server and 2 backend servers running apache tomcat. When I connect to nginx LB IP, it just keeps requesting to the backend servers repeatedly (web browser keep refreshing the page). Please see attachment file of nginx.conf

Please support me with this, I will provide more information if you need

Load balancer IP: 172.29.1.124 (RHEL 7.4) / nginx version: nginx/1.15.10 (nginx-plus-r18)
Backend servers:
- 10.29.81.103, 10.29.81.104 running apache tomcat (jaspersoft)

Thanks

Bad Gateway (no replies)

$
0
0
Hi Everyone.


We are attempting to use NGINX as a reverse proxy for WebAccess webbased email (upstream apache and tomcat) . We are having some trouble where the body of the email messages are not appearing.


On another server we are having an issue where the connection fails with a Bad gateway.


The nginx server blocks are similiar for both servers and is listed here for review:

#############################################################################

#####################################################
# webaccess (60) **80
#####################################################

server {
listen 80;
listen [::]:80;
server_name webaccess.sub.org;
return 301 https://$server_name;
location / {
proxy_pass https://192.168.1.60;
proxy_set_header host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
#try_files $uri $uri/ /index.php?q=$uri&$args;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}

#####################################################
# webaccess.sub.org;(60)**443
#####################################################

server {
listen 443 ssl;
server_name webaccess.sub.org;

ssl_protocols TLSv1.2;
#ssl_protocols TLSv1.3
ssl_prefer_server_ciphers on;
#ssl_dhparam /etc/nginx/dhparam.pem; # openssl dhparam -out /etc/nginx/dhparam.pem 4096
ssl_ciphers ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS;
#ssl_ciphers EECDH+AESGCM:EDH+AESGCM;
ssl_ecdh_curve secp384r1; # Requires nginx >= 1.1.0
#ssl_session_timeout 24h;
ssl_session_timeout 10m;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off; # Requires nginx >= 1.5.9
ssl_stapling on; # Requires nginx >= 1.3.7
ssl_stapling_verify on; # Requires nginx => 1.3.7
#resolver $DNS-IP-1 $DNS-IP-2 valid=300s; #new item
resolver_timeout 5s; #new item
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"; #new item
add_header X-Frame-Options DENY; #new item
add_header X-Content-Type-Options nosniff; #new item
add_header X-XSS-Protection "1; mode=block"; #new item
keepalive_timeout 300s;

ssl_certificate /etc/letsencrypt/live/webaccess.sub.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/webaccess.sub.org/privkey.pem;

charset utf-8;

location / {
include proxy_params;
proxy_pass https://192.168.1.60;
#proxy_redirect on;

# Handle Web Socket connections
proxy_http_version 1.1;
#proxy_cache_bypass $http_upgrade; ####new

}
############################################################}

Setting cookie flag secure (no replies)

$
0
0
Trying to set the Secure cookie flag for several of my locations. I've tried this with both 1.14.2 & .1.16.0 compiled from source.
I've downloaded and compiled the nginx_cookie_flag_module module against both versions, and the module seems to load successfully.

What I'm trying to achieve:
- browser hits http://qa.internal.com/test.gif
- if it doesn't have a cookie already set:
- set a cookie with UUID (generated with perl mod, which has been working fine), with Secure flag & SameSite set
- redirect to page no-cookie-found.html (302)
- if it does have a cookie already set:
- redirect to page cookie-found.html (302)

How I know it's not working:
- Chrome 74.x developer tools show no status for either Secure or SameSite
- Firefox 67.0 developer tools show no status for either Secure or SameSite

Config snippets:
nginx.conf:
_________________

user nginx;
worker_processes 2;
load_module modules/ngx_http_cookie_flag_filter_module.so;

error_log /var/log/nginx/error.log debug;
....
include /etc/nginx/sites-enabled/*;



/etc/nginx/sites-enabled/site.com:
_________________
server {
listen 80;
server_name qa.internal.com;

access_log /var/log/nginx/qa.internal.com.access.log;
error_log /var/log/nginx/qa.internal.com.error.log debug;

root /var/www/qa.internal.com.com/latest/;
index index.html;

# set_cookie_flag SameSite=Lax secure; <-- tried this up here as well, no workie

location = /test.gif {
if ($cookie_uuid) {
add_header Cache-Control "public";
expires 1d;
# Re-direct locally just to validate rewrite gets hit when testing in lower envs
rewrite ^ http://qa.internal.com/cookie-found.html;
break;
}


add_header Set-Cookie "uuid=$internal_uuid;Expires=12/31/2038;Max-Age=630720000";
set_cookie_flag SameSite=Lax secure;
# proxy_cookie_path /* "/; secure; SameSite=strict"; <-- also tried this without success

# Re-direct locally just to validate rewrite gets hit when testing in lower envs
rewrite ^ http://qa.internal.com/no-cookie-found.html;
}

}

I've moved the set_cookie_flag around in the config (server & location), but nothing seems to work. The cookies are being set, but without the required flags.

Debug output:
__________________
2019/07/10 17:29:10 [notice] 24870#0: *7 rewritten redirect: "http://qa.internal.com/no-cookie-found.html", client: 10.50.0.105, server: qa.internal.com, request: "GET /test.gif HTTP/1.1", host: "qa.internal.com"
2019/07/10 17:29:10 [debug] 24870#0: *7 http finalize request: 302, "/test.gif?" a:1, c:1
2019/07/10 17:29:10 [debug] 24870#0: *7 http special response: 302, "/test.gif?"
2019/07/10 17:29:10 [debug] 24870#0: *7 http set discard body
2019/07/10 17:29:10 [debug] 24870#0: *7 filter http_cookie_flag is enabled
2019/07/10 17:29:10 [debug] 24870#0: *7 perl variable handler
2019/07/10 17:29:10 [debug] 24870#0: *7 perl variable done
2019/07/10 17:29:10 [debug] 24870#0: *7 http script copy: "uuid="
2019/07/10 17:29:10 [debug] 24870#0: *7 http script var: "3aa7408aa33811e9a473e7de29dc7053"
2019/07/10 17:29:10 [debug] 24870#0: *7 http script copy: ";Expires=12/31/2038"
2019/07/10 17:29:10 [debug] 24870#0: *7 HTTP/1.1 302 Moved Temporarily
Server: nginx
Date: Wed, 10 Jul 2019 17:29:10 GMT
Content-Type: text/html
Content-Length: 138
Connection: keep-alive
Location: http://qa.internal.com/no-cookie-found.html
Set-Cookie: uuid=3aa7408aa33811e9a473e7de29dc7053;Expires=12/31/2038

any help is appreciated!

Need to have this apache rewrite converted (no replies)

$
0
0
I tried already with all available automated converters, but it seems does not work, i either get 404 error or html file get downloaded.
Here is code from htaccess:
RewriteEngine on

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

<IfModule mod_headers.c>
<FilesMatch ".(eot|otf|svg|ttf|woff|woff2)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>

RewriteRule ^get/([0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([0-9]+)/([0-9]+)/([a-zA-Z0-9\.]+)$ stp/flv.php?storage_id=$1&hash=$2&time=$3&subdir=$4&id=$5&file=$6&%{QUERY_STRING} [L]
RewriteRule ^click/(video|gallery)/([a-zA-Z0-9]+)/([a-zA-Z0-9-]+)$ stp/stp.php?type=$1&id=$2&title=$3%{QUERY_STRING} [L]
RewriteRule ^click/([0-9-]+)/(video|gallery)/([a-zA-Z0-9-]+)-([a-zA-Z0-9]+)\.html$ stp/stp.php?&page=$1&type=$2&id=$4&title=$3&popular=1%{QUERY_STRING} [L]
RewriteRule ^video/([a-zA-Z0-9-]+)-([a-zA-Z0-9]+)\.html$ index.php?view=video&v=$2&%{QUERY_STRING} [L]
RewriteRule ^gallery/([a-zA-Z0-9-]+)-([a-zA-Z0-9]+)\.html$ index.php?view=gallery&g=$2&%{QUERY_STRING} [L]
RewriteRule ^ranked/$ index.php?view=ranked_media&%{QUERY_STRING} [L]
RewriteRule ^embed/([a-zA-Z0-9]+) stp/embed.php?v=$1&%{QUERY_STRING} [L]
RewriteRule ^playlist/([a-zA-Z0-9]+)/([0-9-]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9-]+)\.html$ index.php?view=video&v=$3&playlist=$1&p=$2&%{QUERY_STRING} [L]
RewriteRule ^playlist/([a-zA-Z0-9]+)/([a-zA-Z0-9]+)/([a-zA-Z0-9-]+)\.html$ index.php?view=video&v=$2&playlist=$1&%{QUERY_STRING} [L]
RewriteRule ^playlist/([a-zA-Z0-9-]+)/([0-9]+)/$ index.php?view=playlist&playlist=$1&p=$2 [L]
RewriteRule ^playlist/([a-zA-Z0-9-]+)/$ index.php?view=playlist&playlist=$1 [L]

RewriteRule ^(videos|galleries)/$ index.php?view=categories&type=$1&%{QUERY_STRING} [L]
RewriteRule ^(videos|galleries)/([a-zA-Z0-9_-]+)-(recent|view|rate|length|vip|popular|popular_all)\.html$ index.php?view=categories&type=$1&main_cat=$2&sort=$3&%{QUERY_STRING} [L]
RewriteRule ^(videos|galleries)/([a-zA-Z0-9_-]+)-(recent|view|rate|length|vip|popular|popular_all)-([0-9]+)\.html$ index.php?view=categories&type=$1&main_cat=$2&sort=$3&p=$4&%{QUERY_STRING} [L]
RewriteRule ^(videos|galleries)/([a-zA-Z0-9-]+)/$ index.php?view=categories&type=$1&main_cat=$2&%{QUERY_STRING} [L]
RewriteRule ^(videos|galleries)/([a-zA-Z0-9-]+)/([a-zA-Z0-9_-]+)-[^-]*(recent|view|rate|length|vip|popular|popular_all)\.html$ index.php?view=categories&type=$1&main_cat=$2&sub_cat=$3&sort=$4&%{QUERY_STRING} [L]
RewriteRule ^(videos|galleries)/([a-zA-Z0-9-]+)/([a-zA-Z0-9_-]+)-[^-]*(recent|view|rate|length|vip|popular|popular_all)-([0-9]+)\.html$ index.php?view=categories&type=$1&main_cat=$2&sub_cat=$3&sort=$4&p=$5&%{QUERY_STRING} [L]

RewriteRule ^group/([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)\.html$ index.php?view=group&group=$1&%{QUERY_STRING} [L]
RewriteRule ^group/([a-zA-Z0-9-]+)/forum/$ index.php?view=group_forum&group=$1 [L]
RewriteRule ^group/([a-zA-Z0-9-]+)/videos/$ index.php?view=group_videos&group=$1 [L]
RewriteRule ^group/([a-zA-Z0-9-]+)/galleries/$ index.php?view=group_galleries&group=$1 [L]
RewriteRule ^group/([a-zA-Z0-9-]+)/members/$ index.php?view=group_members&group=$1 [L]

RewriteRule ^groups/$ index.php?view=groups&%{QUERY_STRING} [L]
RewriteRule ^groups/([a-zA-Z0-9-]+)/(([0-9]+)/)?(.*)$ index.php?view=groups&category=$1&p=$3&%{QUERY_STRING} [L]
RewriteRule ^members/(([0-9]+)/)?(.*)$ index.php?view=memberlist&avatar_required=0&content_required=0&p=$2&%{QUERY_STRING} [L]
RewriteRule ^widgets/$ index.php?view=widgets&%{QUERY_STRING} [L]
RewriteRule ^blogs/$ index.php?view=blogs&%{QUERY_STRING} [L]
RewriteRule ^blogs/(([0-9]+)/)?(.*)$ index.php?view=blogs&p=$2&%{QUERY_STRING} [L]

RewriteRule ^profile/([a-zA-Z0-9]+)/$ index.php?view=profile&user=$1 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/blog/([a-zA-Z0-9-]+)-([a-zA-Z0-9]+)\.html$ index.php?view=profile&page=profile_blog_post&post=$3&user=$1 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/blog/$ index.php?view=profile&page=profile_blogs&user=$1 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/blog/([0-9]+)/$ index.php?view=profile&page=profile_blogs&user=$1&p=$2 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/videos/$ index.php?view=profile&page=profile_videos&user=$1 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/videos/([0-9]+)/$ index.php?view=profile&page=profile_videos&user=$1&p=$2 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/galleries/$ index.php?view=profile&page=profile_galleries&user=$1 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/galleries/([0-9]+)/$ index.php?view=profile&page=profile_galleries&user=$1&p=$2 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/favorite-videos/$ index.php?view=profile&page=profile_favorite_videos&user=$1 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/favorite-videos/([0-9]+)/$ index.php?view=profile&page=profile_favorite_videos&user=$1&p=$2 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/favorite-galleries/$ index.php?view=profile&page=profile_favorite_galleries&user=$1 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/favorite-galleries/([0-9]+)/$ index.php?view=profile&page=profile_favorite_galleries&user=$1&p=$2 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/playlists/$ index.php?view=profile&page=profile_playlist&user=$1 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/playlists/([0-9]+)/$ index.php?view=profile&page=profile_playlist&user=$1&p=$2 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/friends/$ index.php?view=profile&page=profile_friends&user=$1 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/friends/([0-9]+)/$ index.php?view=profile&page=profile_friends&user=$1&p=$2 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/groups/$ index.php?view=profile&page=profile_groups&user=$1 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/groups/([0-9]+)/$ index.php?view=profile&page=profile_groups&user=$1&p=$2 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/comments/$ index.php?view=profile&page=profile_comments&user=$1 [L]
RewriteRule ^profile/([a-zA-Z0-9]+)/comments/([0-9]+)/$ index.php?view=profile&page=profile_comments&user=$1&p=$2 [L]

RewriteRule ^categories/((videos|galleries)/)?(.*)$ index.php?view=categories_pick&type=$2&%{QUERY_STRING} [L]
RewriteRule ^categories_list/$ index.php?view=categories_list&%{QUERY_STRING} [L]

RewriteRule ^search/$ index.php?view=search&%{QUERY_STRING} [L]
RewriteRule ^search/([a-zA-Z0-9-]+)/(.*[^/])$ index.php?view=search&search_type=$1&search=$2&%{QUERY_STRING} [L]
RewriteRule ^search/([a-zA-Z0-9-]+)/(.*[^/])/([0-9-]+)/$ index.php?view=search&search_type=$1&search=$2&p=$3&%{QUERY_STRING} [L]

RewriteRule ^feed/([a-zA-Z0-9-]+)/(videos|galleries)/(recent|view|rate|length|vip|featured)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/$ stp/feed.php?view=feed&format=$1&type=$2&sort=$3&main_cat=$4&sub_cat=$5&user=$6&time=$7 [L]
RewriteRule ^feed/([a-zA-Z0-9-]+)/(all|videos|galleries)/deleted/([a-zA-Z0-9_]+)/$ stp/feed.php?view=feed&format=$1&type=$2&type2=deleted&time=$3 [L]

RewriteRule ^callback/billthephone/([0-9]+)/$ stp/payment/callback.php?stp_api=billthephone&stp_method_id=$1&%{QUERY_STRING} [L]
RewriteRule ^callback/([a-zA-Z0-9_-]+)/([a-zA-Z0-9]+)/$ stp/payment/callback.php?stp_api=$1&stp_callback_password=$2&%{QUERY_STRING} [L]
RewriteRule ^callback/([a-zA-Z0-9_-]+)/$ stp/payment/callback.php?stp_api=$1&%{QUERY_STRING} [L]

RewriteRule ^video-comments/([a-zA-Z0-9-]+)/$ index.php?view=comments_video&v=$1 [L]
RewriteRule ^gallery-comments/([a-zA-Z0-9-]+)/$ index.php?view=comments_gallery&g=$1 [L]

RewriteRule ^signup/$ index.php?view=signup [L]
RewriteRule ^login/$ index.php?view=login&%{QUERY_STRING} [L]
RewriteRule ^submit/$ index.php?view=submit [L]
RewriteRule ^terms/$ index.php?view=terms_of_service [L]
RewriteRule ^privacy/$ index.php?view=privacy_policy [L]
RewriteRule ^dmca/$ index.php?view=dmca_policy [L]
RewriteRule ^report-abuse/$ index.php?view=report_abuse [L]
RewriteRule ^contact-us/$ index.php?view=contact_us [L]
RewriteRule ^advertisement/$ index.php?view=advertisement [L]
RewriteRule ^forgot-password/$ index.php?view=forgot_password [L]

Proxy_Pass variable not truncating URL (no replies)

$
0
0
Hi all. I'm relatively new to NGINX as a reverse proxy and have run into a known issue with an unknown solution and need help please.

Currently we have an app that posts to domain.com/liveness and proxy_pass redirects this to an external 3rd party but it only passes through the data from the app after /liveness.

The 3rd party had a failover event on the weekend and as DNS is only reloaded when the config is reloaded, we had an outage on our side as well.

So now I've been tasked with setting up proxy_pass as a variable which I have added to the config. This means every time the variable is referenced it does a DNS lookup (to known internal resolved not on the local host) and it's working.

However the whole url is not passed through eg domain.com/liveness/api/xxx

I'm not an experienced coded so while a rewrite seems the correct way to do this I am baffled by the regex and associated $ variables to get the output sent to proxy_pass part to drop liveness.

Any help would be greatly appreciated. Thanks

"Mixed Content" when redirect post to get file (no replies)

$
0
0
I am trying to change a POST to "/ds" to GET a file "/mock.json". But I have an error in the browser showing "Mixed Content ...This request has been blocked; the content must be served over HTTPS."

My config:

location /ds {
return 200 /mock.json;
}

Help please ;)

Problem running nodejs application with nginx (no replies)

$
0
0
I am trying to run a hello world nodejs application on ubuntu with nginx, on localhost.
the application is running on port 3100.
nginx is running on port 82.
in the browser, it shows 403 error because it doesn't find the index.html file. i want it to redirect to the nodejs application but i don't know how.
I added this code to location / in the default nginx file
proxy_pass http://localhost:3100;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;

Any ideas?
thanks
Viewing all 2931 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>