Hello everyone. i have a following question. How to setup redirect https to http ? I saw many answers in search systems, but i findn't right
↧
how to redirect https to http
↧
Nginx reverse proxy URL getting rewritten
I am using nginx reverse proxy with ingress object to route my requests to kubernetes pod.
With the below config in place, when I place a request to http://myservices.myorg.com/jenkins
My request is going to http://myservices.myorg.com/login?from=%2F
But i want it to go to http://myservices.myorg.com/jenkins/login?from=%2F
So after I manually replaced to above correct path, all the resources like css, js are rendered with wrong path as http://myservices.myorg.com/static/beacae7e/css/simple-page.css
But it must be http://myservices.myorg.com/jenkins/static/beacae7e/css/simple-page.css
Similarly, after I logged in (I think http POST method) it is going to home page (in browser it changes from
http://myservices.myorg.com/jenkins/login to
http://myservices.myorg.com/jenkins
But all the resources rendered again are with wrong path (without /jenkins) -
http://myservices.myorg.com/static/beacae7e/css/layout-common.css
````
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: myingress
spec:
rules:
- host: myservices.myorg.com
http:
paths:
- path: /jenkins
backend:
serviceName: jenkins
service port: 80
````
And below is nginx.conf -
````
http {
server {
listen 80;
server_name ip-10-118-6-35.ec2.internal;
location /jenkins {
proxy_pass https://backend_nodes_jenkins/;
}
}
upstream backend_nodes_jenkins {
server 10.102.194.242:80;
}
}
````
As you can see in above nginx.conf , in proxy_pass I am having slash at the end of the URL since I should not pass /jenkins to my pod.
So this is working as expected but only issue is get requests are rewriting my url I believe. Please help.
With the below config in place, when I place a request to http://myservices.myorg.com/jenkins
My request is going to http://myservices.myorg.com/login?from=%2F
But i want it to go to http://myservices.myorg.com/jenkins/login?from=%2F
So after I manually replaced to above correct path, all the resources like css, js are rendered with wrong path as http://myservices.myorg.com/static/beacae7e/css/simple-page.css
But it must be http://myservices.myorg.com/jenkins/static/beacae7e/css/simple-page.css
Similarly, after I logged in (I think http POST method) it is going to home page (in browser it changes from
http://myservices.myorg.com/jenkins/login to
http://myservices.myorg.com/jenkins
But all the resources rendered again are with wrong path (without /jenkins) -
http://myservices.myorg.com/static/beacae7e/css/layout-common.css
````
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: myingress
spec:
rules:
- host: myservices.myorg.com
http:
paths:
- path: /jenkins
backend:
serviceName: jenkins
service port: 80
````
And below is nginx.conf -
````
http {
server {
listen 80;
server_name ip-10-118-6-35.ec2.internal;
location /jenkins {
proxy_pass https://backend_nodes_jenkins/;
}
}
upstream backend_nodes_jenkins {
server 10.102.194.242:80;
}
}
````
As you can see in above nginx.conf , in proxy_pass I am having slash at the end of the URL since I should not pass /jenkins to my pod.
So this is working as expected but only issue is get requests are rewriting my url I believe. Please help.
↧
↧
Re: Nginx reverse proxy URL getting rewritten
Looks like Jenkins will generate hyperlinks like this. Read from this page - https://wiki.jenkins.io/display/JENKINS/Hyperlinks+in+HTML
So not sure how to proceed..
So not sure how to proceed..
↧
How avoid redirect to login web page
Hi.
Im using nginx as a proxy reverse.
I want that when somebody goes to:
buy.mydomain.com
nginx redirect it to this:
ttp://buy.mydomain.lan/buy/aplicacion.php?ah=st5c45d459b499c0.52378515&ai=buy||110000003;
And this is working fine!
But, if i put this
buy.mydomain.com/sdfa/ (or whatever)
nginx redirect to the web login of my server... (and i dont want that).
What i could do tho fix this??
Thanks to all and thanks for your time.
ps.:i dont speak english.
------------------------------------------------------------------------------------------------------
This is my config.
server {
listen 80;
# subdominio exclusivo para acceso externo
server_name buy.mydomain.com;
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_read_timeout 60s;
# definimos un codigo de error ficticio para redirigir
error_page 418 = @directo;
location / {
# si es POST, debe ir sin controller ni query-string
if ($request_method = POST)
{
return 418;
}
expires -1;
# servidor interno donde corre buy
proxy_pass http://buy.mydomain.lan/buy/aplicacion.php?ah=st5c45d459b499c0.52378515&ai=buy||110000003;
#proxy_pass http://buy.mydomain.lan/buy/aplicacion.php?ai=buy||101000212;
proxy_redirect http://buy.mydomain.lan:80/ /;
}
# assets de buy/
location ~ /(skins|img|css|temp|js)/ {
return 418;
}
# acceso directo sin controller
location @directo {
expires -1;
# servidor interno donde corre buy
proxy_pass http://buy.mydomain.lan:80;
}
}
}
Im using nginx as a proxy reverse.
I want that when somebody goes to:
buy.mydomain.com
nginx redirect it to this:
ttp://buy.mydomain.lan/buy/aplicacion.php?ah=st5c45d459b499c0.52378515&ai=buy||110000003;
And this is working fine!
But, if i put this
buy.mydomain.com/sdfa/ (or whatever)
nginx redirect to the web login of my server... (and i dont want that).
What i could do tho fix this??
Thanks to all and thanks for your time.
ps.:i dont speak english.
------------------------------------------------------------------------------------------------------
This is my config.
server {
listen 80;
# subdominio exclusivo para acceso externo
server_name buy.mydomain.com;
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_read_timeout 60s;
# definimos un codigo de error ficticio para redirigir
error_page 418 = @directo;
location / {
# si es POST, debe ir sin controller ni query-string
if ($request_method = POST)
{
return 418;
}
expires -1;
# servidor interno donde corre buy
proxy_pass http://buy.mydomain.lan/buy/aplicacion.php?ah=st5c45d459b499c0.52378515&ai=buy||110000003;
#proxy_pass http://buy.mydomain.lan/buy/aplicacion.php?ai=buy||101000212;
proxy_redirect http://buy.mydomain.lan:80/ /;
}
# assets de buy/
location ~ /(skins|img|css|temp|js)/ {
return 418;
}
# acceso directo sin controller
location @directo {
expires -1;
# servidor interno donde corre buy
proxy_pass http://buy.mydomain.lan:80;
}
}
}
↧
Re: Nginx reverse proxy URL getting rewritten
Figured it out by passing as env variable in docker CMD - JENKINS_OPTS="--prefix=/jenkins"
↧
↧
nginx autoinstaller no welcome page
Hi so I thought I would try the autoinstaller from, https://github.com/angristan/nginx-autoinstall. But once finished installing and I go to the URL it is just giving me: Firefox can't establish a connection to the server at. Is there any docs for this or something?
↧
proxy_pass problems
I use nginx as a reverse proxy. This worked for me perfectly in the past, but today I was playing around with the config and I must have messed something up seriously, cause it's no longer working. The problem is that the frontend/browser is getting the proxy_pass url forwarded. So I go to website https://example.org. This website proxy passes to 127.0.0.1 with
server {
listen 443 ssl;
server_name example.org;
location / {
proxy_pass http://127.0.0.1:9680;
# include /etc/nginx/proxy.conf;
}
}
and in my browser I get an error on 127.0.0.1 which (obviously) can't be reached. As you can see I commented out my proxy.conf as I must have messed up something there, but what proxy settings do I need to make sure that the client never ever sees my internal addresses?
server {
listen 443 ssl;
server_name example.org;
location / {
proxy_pass http://127.0.0.1:9680;
# include /etc/nginx/proxy.conf;
}
}
and in my browser I get an error on 127.0.0.1 which (obviously) can't be reached. As you can see I commented out my proxy.conf as I must have messed up something there, but what proxy settings do I need to make sure that the client never ever sees my internal addresses?
↧
Need Help with SSL Installation on NGINX.conf settings?
I'm a new user to any sort of self managed server (VPS). I'm use to using cPanel so this is a huge learning curve for me :) which is good!
I'm running a Wordpress Site that is running on NGINX.
I've obtained an SSL Certificate via crazydomains.com.au and have received all files from them;
AddTrustExternalCARoot.crt
USERTrustRSAAddTrustCA.crt
USERTrustRSADomainValidationSecureServerCA.crt
zasel_com_au.crt
First thing I did was update the http.conf file to direct all http to https.
What I need to do is now Install the SSL Cert on my server for it to be shown.
How do I do this?
I have no idea where to begin and as it's my first time, would highly appreciate if someone can help me out.
Many Thanks
I'm running a Wordpress Site that is running on NGINX.
I've obtained an SSL Certificate via crazydomains.com.au and have received all files from them;
AddTrustExternalCARoot.crt
USERTrustRSAAddTrustCA.crt
USERTrustRSADomainValidationSecureServerCA.crt
zasel_com_au.crt
First thing I did was update the http.conf file to direct all http to https.
What I need to do is now Install the SSL Cert on my server for it to be shown.
How do I do this?
I have no idea where to begin and as it's my first time, would highly appreciate if someone can help me out.
Many Thanks
↧
How do i set default/standard permissions for a web server root?
I have a web server root defined at /opt/server, however when I try to access my server in the browser, I get 403 forbidden on any path.
How do I reset every file & directory in the web root so that nginx can access the contents? Also I would like my local user (username "john", default group "users") to have full read/write/execute access to the web server directory & files as well.
I'm using arch linux, so the user & group for nginx is "http" and not "www-data".
Currently, these are the permissions for my web root directory: "drwxrwx--- john users"
How do I reset every file & directory in the web root so that nginx can access the contents? Also I would like my local user (username "john", default group "users") to have full read/write/execute access to the web server directory & files as well.
I'm using arch linux, so the user & group for nginx is "http" and not "www-data".
Currently, these are the permissions for my web root directory: "drwxrwx--- john users"
↧
↧
Attempted Uploaded Files Received Are Garbled Characters, But Works Fine with POSTMAN tool
Initially All code was working fine, however within the past few weeks, I have added a couple more domains behind a reverse NGINX proxy. It was until recently I noticed my one app unable to properly upload files.
After what has been several days of narrowing down potential issues, from testing code, testing file paths, folder and file permissions, I have narrowed down to what could be the cause. After scouring 100s of web pages, comment posts, forums, I am just not sure how to solve precisely.
When I upload a picture from my app, it comes out in garbled characters as posted in an image attached.
When I use the same API to upload from Postman Tool, it uploads perfectly well and gives these results, image attached.
I noticed it could be something with the encoding, the Postman states it has a 7-bit encoding, and it works perfect, uploads the file to the proper directory and everything.
I am using Form Data to send to the API. Again, this was working perfectly before, until around the time I added 2 more domains behind the proxy.
Any ideas?
After what has been several days of narrowing down potential issues, from testing code, testing file paths, folder and file permissions, I have narrowed down to what could be the cause. After scouring 100s of web pages, comment posts, forums, I am just not sure how to solve precisely.
When I upload a picture from my app, it comes out in garbled characters as posted in an image attached.
When I use the same API to upload from Postman Tool, it uploads perfectly well and gives these results, image attached.
I noticed it could be something with the encoding, the Postman states it has a 7-bit encoding, and it works perfect, uploads the file to the proper directory and everything.
I am using Form Data to send to the API. Again, this was working perfectly before, until around the time I added 2 more domains behind the proxy.
Any ideas?
↧
Replace php-fpm by Unit - user certificate information?
Hello,
I want to replace php-fpm by Unit on one internal project. In the same time we want to add an additional security level - use X.509 authentication for users.
When I search the information about configuring php-fpm - I find the following directives to add in nginx.conf:
fastcgi_param SSL_CLIENT_VERIFY $ssl_client_verify;
fastcgi_param SSL_CLIENT_S_DN $ssl_client_s_dn;
But I could not find anything about configuring Unit at the same manner.
Someone can help me with such information, please?
Peter
I want to replace php-fpm by Unit on one internal project. In the same time we want to add an additional security level - use X.509 authentication for users.
When I search the information about configuring php-fpm - I find the following directives to add in nginx.conf:
fastcgi_param SSL_CLIENT_VERIFY $ssl_client_verify;
fastcgi_param SSL_CLIENT_S_DN $ssl_client_s_dn;
But I could not find anything about configuring Unit at the same manner.
Someone can help me with such information, please?
Peter
↧
Re: Access to AWS S3
Did you ever get an answer to this. I have the same issue.
↧
FastCGI Cache not working
Hello people,
As the title say, I need some help in setting up FastCGI Cache on my VPS but I'm having some problems. I configured my nginx.conf and site conf file but when I run ab benchmark I get worst results than without FastCGI (time per request, requests per second etc). The VPS (Debian 9) and ab benchmark (Mint Linux) servers are in the same network, but on different VLANs.
Attached are my nginx conf files if you need to take a look.
Thanks in advance,
Adrian
As the title say, I need some help in setting up FastCGI Cache on my VPS but I'm having some problems. I configured my nginx.conf and site conf file but when I run ab benchmark I get worst results than without FastCGI (time per request, requests per second etc). The VPS (Debian 9) and ab benchmark (Mint Linux) servers are in the same network, but on different VLANs.
Attached are my nginx conf files if you need to take a look.
Thanks in advance,
Adrian
↧
↧
What happens when all the servers are busy
Hello,
I want to know il it is possible to configure Nginx to keep in memory a incoming request when all server are busy.
When a server become available, Nginx gives it the pending request.
When I say server, I am telling about socket declared like this in Nginx configuration :
upstream fastcgi_authorizer_servers {
server unix:/var/tmp/nginx/fastcgi-authorizer-1.socket max_conns=1;
server unix:/var/tmp/nginx/fastcgi-authorizer-2.socket max_conns=1;
server unix:/var/tmp/nginx/fastcgi-authorizer-3.socket max_conns=1;
server unix:/var/tmp/nginx/fastcgi-authorizer-4.socket max_conns=1;
server unix:/var/tmp/nginx/fastcgi-authorizer-5.socket max_conns=1;
server unix:/var/tmp/nginx/fastcgi-authorizer-6.socket max_conns=1;
server unix:/var/tmp/nginx/fastcgi-authorizer-7.socket max_conns=1;
server unix:/var/tmp/nginx/fastcgi-authorizer-8.socket max_conns=1;
}
Thanks
I want to know il it is possible to configure Nginx to keep in memory a incoming request when all server are busy.
When a server become available, Nginx gives it the pending request.
When I say server, I am telling about socket declared like this in Nginx configuration :
upstream fastcgi_authorizer_servers {
server unix:/var/tmp/nginx/fastcgi-authorizer-1.socket max_conns=1;
server unix:/var/tmp/nginx/fastcgi-authorizer-2.socket max_conns=1;
server unix:/var/tmp/nginx/fastcgi-authorizer-3.socket max_conns=1;
server unix:/var/tmp/nginx/fastcgi-authorizer-4.socket max_conns=1;
server unix:/var/tmp/nginx/fastcgi-authorizer-5.socket max_conns=1;
server unix:/var/tmp/nginx/fastcgi-authorizer-6.socket max_conns=1;
server unix:/var/tmp/nginx/fastcgi-authorizer-7.socket max_conns=1;
server unix:/var/tmp/nginx/fastcgi-authorizer-8.socket max_conns=1;
}
Thanks
↧
Reverse proxy for S3 bucket with wildcard
What I want is to pass somehow bucket name to aws_s3_bucket and proxy_pass. Configuration below works as expected but it is configured to single static bucket. So to access file from the defined in the config bucket, I have to call http://IP_or_hostname/file, what I want is http://IP_or_file/$bucket/file. This is based on https://github.com/anomalizer/ngx_aws_auth module which doesn't support variables as mentioned here: https://github.com/anomalizer/ngx_aws_auth/issues/49. Is it possible with Nginx?
Config:
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
client_max_body_size 100G;
aws_access_key 'AKI';
aws_signing_key "xyz";
aws_key_scope "20190226/eu-west-2/s3/aws4_request";
aws_s3_bucket 'bucket_name';
location / {
aws_sign;
aws_access_key "AKI";
aws_signing_key "xyz";
aws_key_scope "20190226/eu-west-2/s3/aws4_request";
aws_endpoint "s3.eu-west-2.amazonaws.com";
proxy_pass http://bucket_name.s3.eu-west-2.amazonaws.com/;
resolver 8.8.8.8 valid=300s;
resolver_timeout 10s;
}
}
}
Config:
worker_processes 1;
events {
worker_connections 1024;
}
http {
server {
listen 80;
client_max_body_size 100G;
aws_access_key 'AKI';
aws_signing_key "xyz";
aws_key_scope "20190226/eu-west-2/s3/aws4_request";
aws_s3_bucket 'bucket_name';
location / {
aws_sign;
aws_access_key "AKI";
aws_signing_key "xyz";
aws_key_scope "20190226/eu-west-2/s3/aws4_request";
aws_endpoint "s3.eu-west-2.amazonaws.com";
proxy_pass http://bucket_name.s3.eu-west-2.amazonaws.com/;
resolver 8.8.8.8 valid=300s;
resolver_timeout 10s;
}
}
}
↧
nginx WEBP from JPG
Hello.
In one of the videos on youtube I heard that there is such an opportunity in nginx:
send the jpg image format to the user in the browser but the contents of the webp file using nginx
those. file, for example, named https://site.org/images/image.jpg
posted on the server in jpeg format. When a browser that supports WEBP accesses it, nginx gives this image:
https://site.org/images/image.jpg
but in WEBP format. With a corresponding decrease in its size.
How is this implemented?
-----
video [RU]
https://www.youtube.com/watch?v=-D6LHUQQBRI
In one of the videos on youtube I heard that there is such an opportunity in nginx:
send the jpg image format to the user in the browser but the contents of the webp file using nginx
those. file, for example, named https://site.org/images/image.jpg
posted on the server in jpeg format. When a browser that supports WEBP accesses it, nginx gives this image:
https://site.org/images/image.jpg
but in WEBP format. With a corresponding decrease in its size.
How is this implemented?
-----
video [RU]
https://www.youtube.com/watch?v=-D6LHUQQBRI
↧
Re: nginx WEBP from JPG
https://ruhighload.com/Оптимизация+изображений+с+webp
thank you, bro!
thank you, bro!
↧
↧
How to compile nginx on Windows with Visual C++?
http://nginx.org/en/docs/howto_build_on_win32.html claims that nginx can be built with Visual C/C++, however auto/configure always fails here: https://github.com/nginx/nginx/blob/master/auto/types/sizeof because <sys/time.h> is not part of Visual C/C++. Nevertheless, the Windows binaries that are posted seem to be compiled with it, as there are string references in the executable to "Visual C++ CRT". So I feel like I must be missing something obvious.
Please help!
Please help!
↧
Re: How to compile nginx on Windows with Visual C++?
Stick to a binary ready version http://nginx-win.ecsds.eu/
↧
Re: How to compile nginx on Windows with Visual C++?
I wish I could, but I need to make changes to the source. The circumstances are not really important. Suffice it to say that my goal is to build it myself.
Are you saying that the Windows build is no longer supported? If so, how do you explain the Windows binaries?
Are you saying that the Windows build is no longer supported? If so, how do you explain the Windows binaries?
↧