Nginx Forum - Migration from Other Servers Anything related to migrating to nginx, including rewrites http://www.ldmicj.icu/list.php?9 Sun, 29 Nov 2020 20:54:03 -0500 Phorum 5.2.16 http://www.ldmicj.icu/read.php?9,289672,289672#msg-289672 NGINX add fakebasic auth like in Apache (no replies) http://www.ldmicj.icu/read.php?9,289672,289672#msg-289672
Apache conf:

SSLCACertificateFile /etc/apache2/ssl/ca.pem
SSLVerifyClient require
SSLVerifyDepth 2

<Location />
SSLOptions +FakeBasicAuth +StrictRequire
Require valid-user
AuthName "Authentication"
AuthType Basic
AuthUserFile "/etc/apache2/ssl/httpd.passwd"
</Location>

current NGINX conf:

ssl_client_certificate /etc/pki/tls/custom-ca-bundle.pem;
ssl_verify_client on;
ssl_verify_depth 2;

if ($ssl_client_verify != SUCCESS) {
return 403;
}

auth_basic "Authentication";
auth_basic_user_file /etc/nginx/.htpasswd;

For Apache now doing this job prefectly: SSLOptions +FakeBasicAuth, but I don't know how to do it for NGINX.]]>
marek.vesely Migration from Other Servers Wed, 07 Oct 2020 01:30:25 -0400
http://www.ldmicj.icu/read.php?9,288265,288265#msg-288265 NGINX SSL error (no replies) http://www.ldmicj.icu/read.php?9,288265,288265#msg-288265 Today i have a problem with HTTPS, i tried config HTTPS like link below and my result is "400 Bad Request No required SSL certificate was sent"
I tried check error log and just receive error "Signal process started". I have sent attach file config in post, please help me. Thanks you very much

https://www.digitalocean.com/community/tutorials/how-to-host-a-website-using-cloudflare-and-nginx-on-ubuntu-16-04]]>
daydien789 Migration from Other Servers Thu, 04 Jun 2020 03:44:38 -0400
http://www.ldmicj.icu/read.php?9,286667,286667#msg-286667 error to start nginx (no replies) http://www.ldmicj.icu/read.php?9,286667,286667#msg-286667 my nginx does not start!
I have this error

  nginx: [emerg] "tcp_nopush" directive is duplicate in /etc/nginx/conf?conf:6
nginx: configuration file /etc/nginx/nginx.conf test failed
nginx.service: Control process exited, code = exited status = 1
  nginx.service: Failed with result 'exit-code'.
Failed to start A high performance web server and a reverse proxy server.]]>
wall18 Migration from Other Servers Tue, 07 Jan 2020 12:23:06 -0500
http://www.ldmicj.icu/read.php?9,285821,285821#msg-285821 Migrating existing Nginx to Docker (1 reply) http://www.ldmicj.icu/read.php?9,285821,285821#msg-285821
I have copied all files in:
- /etc/nginx to /home/raphattack/docker/nginx/etc
- /usr/share/nginx to /home/raphattack/docker/nginx/share

I am using the following command to run the Docker image:
sudo docker run --detach \
--name nginx \
--publish 80:80 \
--publish 443:443 \
--volume /home/raphattack/docker/nginx/etc:/etc/nginx \
--volume /home/raphattack/docker/nginx/share:/usr/share/nginx \
nginx

This fails with the error:
2019/10/08 21:18:58 [emerg] 1#1: open() "/etc/nginx/modules-enabled/50-mod-http-geoip.conf" failed (2: No such file or directory) in /etc/nginx/nginx.conf:4
nginx: [emerg] open() "/etc/nginx/modules-enabled/50-mod-http-geoip.conf" failed (2: No such file or directory) in /etc/nginx/nginx.conf:4

Line 4 in my nginx.conf:
include /etc/nginx/modules-enabled/*.conf;

The file in question is a symlink:
/etc/nginx/modules-enabled/50-mod-http-geoip.conf -> /usr/share/nginx/modules-available/mod-http-geoip.conf]]>
raphattack Migration from Other Servers Tue, 15 Oct 2019 09:06:50 -0400
http://www.ldmicj.icu/read.php?9,285052,285052#msg-285052 Wordpress Multi-Site Issue after Migration (no replies) http://www.ldmicj.icu/read.php?9,285052,285052#msg-285052
These URLs do not work correctly, they are supposed to be sites in themselves:

http://www.c3summitllc.com/business2016/agenda/

http://www.c3summitllc.com/healthcare2016/

Any insights on how to mend this issue will be appreciated.]]>
borntodeal Migration from Other Servers Wed, 31 Jul 2019 02:45:23 -0400
http://www.ldmicj.icu/read.php?9,284497,284497#msg-284497 lighttpd config change to nginx (no replies) http://www.ldmicj.icu/read.php?9,284497,284497#msg-284497
alias.url += ( "/ui/" => "/usr/local/opnsense/www/" )
alias.url += ( "/api/" => "/usr/local/opnsense/www/" )
url.rewrite-if-not-file = ( "^/ui/([^\?]+)(\?(.*))?" => "/ui/index.php?_url=/$1&$3" ,
"^/api/([^\?]+)(\?(.*))?" => "/api/api.php?_url=/$1&$3"
)

I want to change this config into nginx .]]>
sharif.hossain Migration from Other Servers Mon, 10 Jun 2019 06:35:57 -0400
http://www.ldmicj.icu/read.php?9,284406,284406#msg-284406 Convert htaccess file to nginx config file. (no replies) http://www.ldmicj.icu/read.php?9,284406,284406#msg-284406

RewriteEngine On

RewriteCond /var/www/html/usluno/coopshop/$1/$2 -f
RewriteRule (bin|html|libs)/((.*)\.(htm|html|js|gif|jpg|png|css|ico|php|woff|svg|ttf|eot|pdf)$)/var/www/html/usluno/coopshop/$1/$2 [NC,L]

RewriteRule \.(htm|html|js|gif|jpg|png|css|ico|php|pdf)$ - [NC,L]

RewriteRule
(tmp/backend|tmp/frontend|libs|html/templates|mods|_htaccess|_sql) - [NC,L,F]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+[^/])$ /$1/ [R=301,L,QSA,NE]

RewriteCond %{HTTP_HOST} !^coopshop.local
RewriteRule (.*) http://coopshop.local/$1 [R=301,QSA,L]

RewriteRule ^t([a-zA-Z0-9]{32})\/$ /customer/password/?action=3&token=$1 [R=301,L,QSA,NC]

# Prepis na controller/dispatcher
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*?)/?$ /controller.php?MRW_CONTROLLER_URI=$1&MRW_CONTROLLER_HOST=%{HTTP_HOST} [L,QSA,NC]


I tried to convert with online converter. Here is converted nginx config file.


# nginx configuration

location ~ \.(htm|html|js|gif|jpg|png|css|ico|php|pdf)$ {
try_files $uri $uri/ /index.php?$args;
}

location ~ (tmp/backend|tmp/frontend|libs|html/templates|mods|_htaccess|_sql) {
return 403;
}

location / {
rewrite (bin|html|libs)/((.*)\.(htm|html|js|gif|jpg|png|css|ico|php|woff|svg|ttf|eot|pdf)$) /var/www/html/usluno/coopshop/$1/$2 break;
if (!-e $request_filename){
rewrite ^/(.+[^/])$ /$1/ redirect;
}
if ($http_host !~ "^coopshop.local"){
rewrite ^(.*)$ http://coopshop.local/$1 redirect;
}
rewrite "^/t([a-zA-Z0-9]{32})\/$" /customer/password/?action=3&token=$1 redirect;
if (!-e $request_filename){
rewrite ^/(.*?)/?$ /controller.php?MRW_CONTROLLER_URI=$1&MRW_CONTROLLER_HOST=$http_host break;
}


Home page is working, but when I click on link on page, it download PHP file instead of load the page.

Here is my vhost config.


server {
listen 80;
listen [::]:80;
server_name php56.coopshop.local;
root /var/www/html/usluno/php56/coopshop;
index index.php;
location ~* \.php$ {
# With php-fpm unix sockets
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
try_files $uri $uri/ /index.php?$args;
}
location ~ /\.ht {
deny all;
}
access_log /var/log/nginx/php56_coopshop_access.log;
error_log /var/log/nginx/php56_coopshop_error.log;
include /var/www/html/usluno/php56/coopshop/nginx.conf;
}


Of course I add domain to my hosts.


127.0.0.1 php56.coopshop.local


Where could be the problem? Thank you very much for every idea!

BR

Stan]]>
stanislavhosek Migration from Other Servers Sun, 02 Jun 2019 06:44:51 -0400
http://www.ldmicj.icu/read.php?9,284114,284114#msg-284114 Load balancing (no replies) http://www.ldmicj.icu/read.php?9,284114,284114#msg-284114
I want to load-balance the subdomains of the a.com domain.
I want to split the connection to a.com/index1-10.html into two separate servers.
Upon accessing a.com/index1.html,

The server of 1.1.1.1 or the server of 1.1.1.2
to index1.html.]]>
rootsm Migration from Other Servers Thu, 09 May 2019 03:09:01 -0400
http://www.ldmicj.icu/read.php?9,283999,283999#msg-283999 reverse proxy (no replies) http://www.ldmicj.icu/read.php?9,283999,283999#msg-283999
I have a question. I yust started with nginx and i am tryin to accomplish something. I have a webmail application and i want it to access true a reverse proxy. i attached the code in an attachment.

now i i browse webmail.ckruijntjens.nl it shows me the login page bit after login is done
____________________________________________________________________________________
i get the following error:

Not Found
The requested URL /webapp/webapp/ was not found on this server.

Apache/2.4.25 (Debian) Server at webmail.ckruijntjens.nl Port 443
____________________________________________________________________________________

Wat have i done wrong here?]]>
ckruijntjens Migration from Other Servers Thu, 02 May 2019 09:41:34 -0400
http://www.ldmicj.icu/read.php?9,283636,283636#msg-283636 IE11 not rendering page with Nginx reverse proxy - Help (no replies) http://www.ldmicj.icu/read.php?9,283636,283636#msg-283636
I'd like to know if anyone encounter the same error. I have a frontend app written in Angular and the requirement is to use Nginx reverse proxy that will accept browser connection and pass it to frontend app. Unfortunately, only the IE browser cannot render the frontend app while working fine with other browsers like Chrome, Firefox, or Safari.


I tried to simulate this issue with a fresh install Nginx vs the existing Nginx in our environment (see below): The problem is our frontend webapp is not rendering in our existing Nginx.


fresh install nginx (all browser works), URL: https://<frontend-nginx>/:
location / {
proxy_pass http://<frontend-webapp>:8083;
}


existing nginx (all browser works except in IE11), URL: https://<frontend-nginx>/webapp/:
location /webapp/ {
# with or without slash working in other browsers except IE.
rewrite /webapp/?(.*)$ /$1 break;
proxy_pass http://<frontend-webapp>:8083;
}




Br,
Bernard]]>
bparinas Migration from Other Servers Fri, 05 Apr 2019 15:04:17 -0400
http://www.ldmicj.icu/read.php?9,283467,283467#msg-283467 unable to patch nginx source (no replies) http://www.ldmicj.icu/read.php?9,283467,283467#msg-283467
[root@linux nginx]# patch -p1 </usr/local/nginx/0004-Accept-variable-name-as-upload_limit_rate-argument.patch
can't find file to patch at input line 14
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|From 8f4cad171fe4fed9cbd11a6a10fb4880e49bf9f6 Mon Sep 17 00:00:00 2001
|From: example <example@example.com>
|Date: Fri, 12 Feb 2016 11:28:56 +0600
|Subject: [PATCH] Accept variable name as upload_limit_rate argument
|
|---
| ngx_http_upload_module.c | 27 +++++++++++++++++----------
| 1 file changed, 17 insertions(+), 10 deletions(-)
|
|diff --git a/ngx_http_upload_module.c b/ngx_http_upload_module.c
|index 93ded70..6bd5027 100644
|--- a/ngx_http_upload_module.c
|+++ b/ngx_http_upload_module.c
--------------------------
File to patch:

What I am Doing Wrong Any?]]>
fzkhn668 Migration from Other Servers Thu, 21 Mar 2019 14:34:25 -0400
http://www.ldmicj.icu/read.php?9,283046,283046#msg-283046 Migration from F5 to NGINX mappings (no replies) http://www.ldmicj.icu/read.php?9,283046,283046#msg-283046
For the life of me I can't figure out how to mimic this on NGINX. I have a map setup with old to new product ID

map $arg_productid $redirect_to
{
22195 91390;
}

I then want to use this to replace the value of the arg productid with the new value and redirect the client. I only want this to be considered if the productid arg contains the source product id from the mapping. Any ideas?

Thanks]]>
Crys1alshard Migration from Other Servers Tue, 12 Feb 2019 20:19:25 -0500
http://www.ldmicj.icu/read.php?9,282801,282801#msg-282801 apache2nginx migration (no replies) http://www.ldmicj.icu/read.php?9,282801,282801#msg-282801 I'm trayning to migrate my php application from apache 2 server to use nginx, i have some issues configuring some rewrite rules.
My application is Symfony-based (php).

.htaccess configuration is as follows:

<pre><IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
RewriteRule ^(.*) - [E=BASE:%1]

# Sets the HTTP_AUTHORIZATION header removed by Apache
RewriteCond %{HTTP:Authorization} .
RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteRule ^index\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ - [L]

RewriteRule ^ %{ENV:BASE}/index.php [L]
</IfModule></pre>

Mu current application nginx configuration as follows:

<pre>
server {
server_name myapp.test;
root /home/habeeb/myapp/public;

location / {
# try to serve file directly, fallback to app.php
try_files $uri /index.php$is_args$args;


}

location ~ ^/index\.php(/|$) {
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;


fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;

internal;
}

# return 404 for all other php files not matching the front controller
# this prevents access to other php files you don't want to be accessible.
location ~ \.php$ {
return 404;
}



error_log /var/log/nginx/myapp_error.log;
access_log /var/log/nginx/myapp_access.log;

}
</pre>

Could you help me to update this configuration to get the same behaviour as .htaccess above ?

thank you very much !]]>
Habeeb Migration from Other Servers Wed, 23 Jan 2019 14:00:12 -0500
http://www.ldmicj.icu/read.php?9,282774,282774#msg-282774 Need Help (no replies) http://www.ldmicj.icu/read.php?9,282774,282774#msg-282774
I need some help with nginx config, I have created an A record for www.domain.domain.com to point to server where i have cofigured my app www.test.com, i have created below rule to make redirection:

server {
listen 80;
server_name www.domain.domain.com *.domain.com;
location = / {
return 301 https://domain.domain.com/Songs/join;
}
}

but i don't know to activate SSL in this server for this subdomain, in above case is the same app used only URL is different. Attached is my nginx configuration.]]>
Edi14 Migration from Other Servers Tue, 22 Jan 2019 06:36:30 -0500
http://www.ldmicj.icu/read.php?9,282610,282610#msg-282610 Nginx and subdomains (no replies) http://www.ldmicj.icu/read.php?9,282610,282610#msg-282610 I amcurrently trying to migrate my server from Apache2 to Nginx

It's working and I have deployed Nextcloud and cops inside var/www folder

Formerly I was using https://mydomain.com/nextcloud, https://mydomain.com/cops etc etc

But now if I write https://mydomain.com I am leaded to nextcloud

same thing for https://mydomain.com/cops : nextcloud is back again.

So my question: I would like to find back subdomain access to use nextcloud, cops, etc etc.

Could you help me to find a solution?

thanx!]]>
elgringo Migration from Other Servers Wed, 09 Jan 2019 17:06:53 -0500
http://www.ldmicj.icu/read.php?9,282517,282517#msg-282517 Nginx config - redirect everything to index - internal 500 server error (no replies) http://www.ldmicj.icu/read.php?9,282517,282517#msg-282517
/public/ -> public folder

/public/res/ -> resources folder (css, js)

/public/index.php -> index site (the only publicly used framework
file, everything else is outside public)

What i want to achieve is that every url except resources folder is pointed to index.php?foo=getvars keeping the current url structure in the address bar.

For example:
`/test2/something/something/` points to `/test2/index.php?foo=something/something/`

If possible, i want this redirect including .php files, so that it redirects like any other url instead of showing "no input file" error (hiding php file extensions).

What i tried so far is throwing a 500 internal error

location ~ ^/public/(?!res)(.*) {

try_files $uri $uri/ /test2/index.php?foo=$1;

}

#block direct php access - not working with redirect
#location ~ ^/public/.*\.php$ {

#return 404;

#}]]>
seba Migration from Other Servers Mon, 31 Dec 2018 07:30:04 -0500
http://www.ldmicj.icu/read.php?9,282403,282403#msg-282403 Publish wordpress website from WAMP to Ubuntu Nginx WebServer (no replies) http://www.ldmicj.icu/read.php?9,282403,282403#msg-282403
Need help publishing our company Website developed in wordpress with mysql Database into Nginx webserver configured under Ubuntu 18.10.
Do i need to install wordpress and mysql in Nginx Webserver and restore mysql db?

Thanks
Jigs]]>
jigs Migration from Other Servers Mon, 17 Dec 2018 01:00:53 -0500
http://www.ldmicj.icu/read.php?9,282312,282312#msg-282312 Rewrite ( Paypal IPN Handler) (2 replies) http://www.ldmicj.icu/read.php?9,282312,282312#msg-282312 Old URL www.velomap.org/?s2member_paypal_notify=1;
New URL www.velomap.org/?optimizemember_paypal_notify=1;

I tried the code below - but it's not rewriting/forwarding the IPN correctly. Would be really glad for some help here.

location / {
rewrite ^/?s2member_paypal_notify=1 ^/?optimizemember_paypal_notify=1 redirect;
try_files $uri $uri/ /index.php?$args;
}]]>
extremecarver Migration from Other Servers Sun, 09 Dec 2018 12:51:41 -0500
http://www.ldmicj.icu/read.php?9,281360,281360#msg-281360 migration from Apache (1 reply) http://www.ldmicj.icu/read.php?9,281360,281360#msg-281360 I am new in nginx.
I had a apache web server and I am trying to migrate to nginx.
I have follow the tuto from DigitalOcean but some point are still not working...

My conf :
2 Ubuntu 18.04 running on virtual Machine (ESXI)
The first one "vm1" receive all the traffic from pfsense when it is on port 80.
Both "vm1" and "vm2" have web services.
"vm1" : the main web site + one imagevuex web site.
"vm2" : cacti web interface

I have put 3 files in the "/etc/nginx/sites-available" and the 3 link in the site-enable.
The 2 files (site1.mydomaine.net ; site2.mydomaine.net ; site3.mydomaine.net) are like this :

-------------------------------------------------------------------------------------------------
server {
listen 80;
root /var/www/site1.mydomaine.net;
index index.php index.html index.htm index.nginx-debian.html;
server_name site1.mydomaine.net;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}
-------------------------------------------------------------------------------------------------

The 3rd file (site3.mydomaine.net) is like this :
-------------------------------------------------------------------------------------------------
server {
listen 80;
server_name site3.mydomaine.net;
index index.php index.html index.htm index.nginx-debian.html;

location / {
proxy_pass http://localIP/cacti/;
proxy_set_header Host $host;

try_files $uri $uri/ =404;
}
location ~ /\.ht {
deny all;
}
}
-------------------------------------------------------------------------------------------------

Now the state of today :
Site1 is working
Site2 and 3 are partially working :
=> When I put site2.mydomaine.net or site3.mydomaine.net in firefox, The index.php work but when "leave" the initial page I get a 404! like if the path was not good.

Any idea ?

Thanks]]>
ewok2 Migration from Other Servers Sat, 29 Sep 2018 06:16:24 -0400
http://www.ldmicj.icu/read.php?9,281351,281351#msg-281351 Rewrite this line from htaccess ton nginx (no replies) http://www.ldmicj.icu/read.php?9,281351,281351#msg-281351
Can someone help me to rewrite this line from htaccess file to Nginx


RewriteRule ^([\w]+)\.api(/(.*))?$ site.php?action=api_$1&arg=$3 [QSA,L]


Thank you :)]]>
Julien Migration from Other Servers Fri, 21 Sep 2018 18:09:12 -0400
http://www.ldmicj.icu/read.php?9,281243,281243#msg-281243 Wordpress/Unbounce on nginx (2 replies) http://www.ldmicj.icu/read.php?9,281243,281243#msg-281243
I hope this is the right forum for this, as it relates to settings given for Apache that need translated to nginx configuration syntax.

So our corporate website is running on a server I control, which runs Wordpress on nginx. One of the departments needs Marketing to run some ads that use the Unbounce plugin for landing pages, which doesn't allow direct URLs to external sites without a modification to our nginx configuration. Without it, Wordpress tries to handle the URL redirect instead of passing the complete URL to Unbounce to handle. The visitor is returned with a 404. Unbounce has just been telling me to 'make it not 404' with nginx. Which clearly isn't very helpful.

So their tech support told me it would work if I 'just used the default Wordpress .htaccess.' After quite a bit of pressuring, they gave me a configuration code block that they think should work, but I am unable to figure out how to use it. I'm much more familiar with Apache, but need to make this work in nginx. But realistically, it looks more like a general idea of what they're looking for than actual an nginx config block. This is where my unfamiliarity with nginx blocks me, and if I had time to just learn it, I would but I'm under the gun timewise.

So below is the code block they gave me:

'/<page>/clkn' --> '<wpserver>/<page>/clkn' (click - non-conversion goal)
'/<page>/clkg' --> '<wpserver>/<page>/clkg' (click - conversion goal)
'/<page>/fsg' --> '<wpserver>/<page>/fsg' (form submission - conversion goal)
'/<page>/fsn' --> '<wpserver>/<page>/fsn' (form submission - non-conversion goal)


So basically I think they're telling me I need to add a config block to tell it to add the site's URL as a FQDN to the links that end in /clkn, /clgk, /fsg, and /fsn. So for example, if the landing page URL is http://mysite.com and the landing page is landingpage, they would want it to look for /landingpage/clkn and replace it with https://mysite.com/landingpage/clkn, I think. I'm not really sure.

Or, perhaps, it's easier to just throw in the Apache .htaccess equivalent into the config file? Either way, I believe these would go into a <location> block, which I don't make use of in my nginx configs, so I need to add that as well somehow. I assume pointing to the root of the Wordpress install? If it would help, I can post a copy of my current config file, sanitized for sensitive information.

I've searched various forums, and have seen one or two others with the same question, but nobody responded. I saw other types of questions, but weren't sure if they were relevant or not. I didn't see anything here in the nginx forums that I could make use of.

Any help with this would be immensely appreciated!!


Thanks,

pdxITgirl]]>
pdxITgirl Migration from Other Servers Wed, 19 Sep 2018 17:50:25 -0400
http://www.ldmicj.icu/read.php?9,280767,280767#msg-280767 How to deploy servlet file on nginx? (no replies) http://www.ldmicj.icu/read.php?9,280767,280767#msg-280767
Would like to find out how to configure nginx to deploy servlet in a step by step manner?

In addition, is it possible to deploy servlet without installing tomcat?

Thanks!]]>
kongoffkong Migration from Other Servers Mon, 06 Aug 2018 04:27:56 -0400
http://www.ldmicj.icu/read.php?9,279192,279192#msg-279192 Ubuntu with multiple webservers and 1 domain (no replies) http://www.ldmicj.icu/read.php?9,279192,279192#msg-279192
So I access my services internally with https://Ubuntu.IP:{NginxHttpsPort} externally https://myDomain.com:{NginxHttpsPort}

Until here works as it should!

Now I wanted to 'stop' using the ports and use for example:
https://myDomain.com <<=== Portainer

https://myDomain.com/gogs <<=== Gogs

https://myDomain.com/privatebin <<=== PrivateBin

I have a template of my Nginx attempt at https://github.com/Sthopeless/HA-Playground/tree/master/Nginx

The https://myDomain.com works but when I try https://myDomain/something goes to a blank page and if refreshed returns to https://myDomain.com]]>
sthopeless Migration from Other Servers Sat, 24 Mar 2018 12:23:16 -0400
http://www.ldmicj.icu/read.php?9,278392,278392#msg-278392 How to replace Apache w/ Nginx that only serves Perl (cgi) based pages? (no replies) http://www.ldmicj.icu/read.php?9,278392,278392#msg-278392 I'm hoping to retire Apache on all my servers with Nginx. I've been running these servers, and
Apache for YEARS, and they've all become a bit of a struggle for Apache. To the point; I almost
never use PHP. The sites are all based on Perl -- cgi scripts with Perl functions in them. Anyway,
I've been reading the documentation, FAQ, and anything else I could find, for a couple of days now.
But don't feel any closer to figuring/knowing how to get a copy of Nginx running for my
circumstances. I see recipes for everything from making good daiquiris, to using Silverstripe, to
every other language/CMS but Perl cgi. Maybe I'm over complicating it in my mind, or perhaps I'm
the only one that uses Perl to serve up web pages. But I'd greatly appreciate any guidance, or
pointers to documentation specific to this circumstance.

Thank you for all your time, and consideration.

--Chris]]>
Chris.H Migration from Other Servers Tue, 06 Feb 2018 22:00:32 -0500
http://www.ldmicj.icu/read.php?9,277665,277665#msg-277665 Apache -> Nginx (no replies) http://www.ldmicj.icu/read.php?9,277665,277665#msg-277665
Is anybody able to translate the following into code compatible with nginx conf?

Thanks

<FilesMatch ".(otf|ttf|eot|woff)$">
SetEnvIf Origin "^http(s)?://(.+.)?(pardot.com|yourdomain.com)$" origin_is=$0
Header set Access-Control-Allow-Origin %{origin_is}e env=origin_is
</FilesMatch>]]>
Doyley Migration from Other Servers Wed, 06 Dec 2017 09:18:07 -0500
http://www.ldmicj.icu/read.php?9,277569,277569#msg-277569 Reverse proxy (no replies) http://www.ldmicj.icu/read.php?9,277569,277569#msg-277569
I have a problem, I want to use nginx as a reverse proxy.
My lan server is reachable by https://test.mydomain.lan/rococo and I want to access it by https://work.rococo.com.

My config file is :
server {
listen 443 ssl;
server_name work.rococo.com;

ssl_certificate /etc/nginx/ssl/rococo.com/rococo.com.crt;
ssl_certificate_key /etc/nginx/ssl/rococo.com/rococo.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM;
ssl_verify_client off;

# gestion des logs
access_log /var/log/nginx/rococo.com_access.log;
error_log /var/log/nginx/rococo.com_error.log;

location ~ /\. {
deny all;
access_log off;
log_not_found off;
}

location / {
allow all;
proxy_pass https://test.mydomain.lan;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
sub_filter_types text/html application/x-javascript;
sub_filter 'https://test.mydomain.lan:443' 'https://test.mydomain.lan/rococo';
sub_filter 'https:\u002f\u002ftest.mydomain.lan:443' 'https://test.mydomain.lan/rococo';
sub_filter 'test.mydomain.lan:443' 'work.rococo.com';
sub_filter_once off;
}
}


This file config doesn't work. Have you an idea?

Thank you for your help]]>
ChMuX Migration from Other Servers Wed, 29 Nov 2017 09:03:18 -0500
http://www.ldmicj.icu/read.php?9,277423,277423#msg-277423 migrating from apache, need help on some rewrite rules (no replies) http://www.ldmicj.icu/read.php?9,277423,277423#msg-277423
I would need some help to convert some apache rewrite rules to nginx,

here is the apache version:
<Location ^/mywebapp>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from 192.168.0.0/16
Allow from 10.10.0.0/16
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !app_dev\.php/.*
RewriteCond %{REQUEST_URI} !app\.php$
RewriteRule (.*) app.php [QSA,L]
</Location>

here is what I have in nginx:
location ~ ^/mywebapp {
allow 127.0.0.1;
allow 192.168.0.0/16;
allow 10.10.0.0/16;
deny all;

location ~ app_dev\.php/.* { }
location ~ app\.php$ { }
if (!-e $request_filename){
rewrite ^(.*)$ app.php break;
}
}

which does not work as intended. Can someone point me where I'm wrong ?

Kind Regards

Nicolas]]>
digrouz Migration from Other Servers Tue, 21 Nov 2017 06:11:30 -0500
http://www.ldmicj.icu/read.php?9,277332,277332#msg-277332 lingering_close closes client connections (1 reply) http://www.ldmicj.icu/read.php?9,277332,277332#msg-277332
I am building a nginx module which get parsed http requests send it to my server, wait for the response from my server and send the client http response.

The nginx close my client connections due to lingering_close:

#3 0x0000000000477647 in ngx_http_terminate_request (r=0x1cb1050, rc=-2) at src/http/ngx_http_request.c:2466
#4 0x0000000000476fb5 in ngx_http_finalize_request (r=0x1cb1050, rc=-2) at src/http/ngx_http_request.c:2303
#5 0x0000000000466b0a in ngx_http_core_content_phase (r=0x1cb1050, ph=0x1bcb6e8) at src/http/ngx_http_core_module.c:1370
#6 0x00000000004653b9 in ngx_http_core_run_phases (r=0x1cb1050) at src/http/ngx_http_core_module.c:847
#7 0x0000000000465304 in ngx_http_handler (r=0x1cb1050) at src/http/ngx_http_core_module.c:830
#8 0x00000000004762e3 in ngx_http_process_request (r=0x1cb1050) at src/http/ngx_http_request.c:1910
#9 0x0000000000474afe in ngx_http_process_request_headers (rev=0x1bcf350) at src/http/ngx_http_request.c:1342
#10 0x0000000000473e95 in ngx_http_process_request_line (rev=0x1bcf350) at src/http/ngx_http_request.c:1022
#11 0x0000000000453c68 in ngx_epoll_process_events (cycle=0x1b8c5c0, timer=500, flags=1) at src/event/modules/ngx_epoll_module.c:822
#12 0x0000000000442346 in ngx_process_events_and_timers (cycle=0x1b8c5c0) at src/event/ngx_event.c:242
#13 0x00000000004514df in ngx_worker_process_cycle (cycle=0x1b8c5c0, data=0x6) at src/os/unix/ngx_process_cycle.c:753
#14 0x000000000044d9a1 in ngx_spawn_process (cycle=0x1b8c5c0, proc=0x4513db <ngx_worker_process_cycle>, data=0x6, name=0x4f5793 "worker process", respawn=-3) at src/os/unix/ngx_process.c:198
#15 0x0000000000450257 in ngx_start_worker_processes (cycle=0x1b8c5c0, n=20, type=-3) at src/os/unix/ngx_process_cycle.c:358
#16 0x000000000044f7ec in ngx_master_process_cycle (cycle=0x1b8c5c0) at src/os/unix/ngx_process_cycle.c:130
#17 0x000000000040ff5c in main (argc=5, argv=0x7fff4c6c5698) at src/core/nginx.c:367


The flow close my request when it is still in progress.

I tried to configure the nginx conf in a few ways but got the same problem:

First config:
lingering_close on;
lingering_time 1000s;
lingering_timeout 600s;

Second config:
lingering_close always;

Third config:
lingering_close off;

Can I disable the flag?

Thanks!]]>
Ortal Migration from Other Servers Thu, 16 Nov 2017 09:52:44 -0500
http://www.ldmicj.icu/read.php?9,277103,277103#msg-277103 Switch from Apache2 to Nginx, Wordpress subdomain (no replies) http://www.ldmicj.icu/read.php?9,277103,277103#msg-277103
I have installed Nginx on Ubuntu 16.04, while my apache server is still running. To avoid conflicts, I use port 8000 on Nginx.

A testing site I can see now as http://bc.elmit.com and as http://bc.elmit.com:8000 That works!!!

I am trying now to get http://aimglobally.net to nginx. Its a Wordpress site with subdomains. I cannot get the main site to work.
I get for http://aimglobally.net:8000 nothing, not even anything in the log file.

In the second step, I want to use ssl, ... maybe there are some mistakes, so that nothing works.

I have attached the default and the aimglobally.net config files.]]>
Elmit Migration from Other Servers Sat, 28 Oct 2017 06:19:23 -0400
http://www.ldmicj.icu/read.php?9,276964,276964#msg-276964 NGINX Proxy pass problem I think! (1 reply) http://www.ldmicj.icu/read.php?9,276964,276964#msg-276964
second, ive been struggling the last 6 hours on that configuration ...
we moved from an environement to another, so it seem ot be DNS issues...

heres the backgroup and config

Somebody updated the nginx config ( behind docker ) without making proper backup ( ok .. its me )
now im struggling , the website should have that structure ..

siemwebsite.portal.siem.local
siemwebsite.z06.rezz.qc.ca

all of my hosts files are ok and dns entry correct too.. With that config I get connection refused
Please... HELP ME. and once again, sorry to bother .. must be real dumb question, but what can I say, im lost atm ...


server {
server_name ~^(?<stack>[^.]+)\.[a-z0-9-]+\.[a-z0-9-]+\.[a-z0-9-]+\.[a-z]+\.[a-z]+$$;
resolver 169.254.169.250 valid=2s ipv6=off;
set $$hostpass "siemonster";
location / {
proxy_pass http://$$hostpass;
proxy_set_header Accept-Encoding "";
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header Upgrade $$http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server {
server_name msa.*;
resolver 169.254.169.250 valid=2s ipv6=off;
set $$hostpass "msa";
location / {
proxy_pass http://$$hostpass;
proxy_set_header Accept-Encoding "";
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header Upgrade $$http_upgrade;
proxy_set_header Connection "upgrade";
}
}

server {
server_name admin.*;
resolver 169.254.169.250 valid=2s ipv6=off;
set $$hostpass "admin";
location / {
proxy_pass http://$$hostpass;
proxy_set_header Accept-Encoding "";
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header Upgrade $$http_upgrade;
proxy_set_header Connection "upgrade";
}
}

server {
server_name 411.*;
resolver 169.254.169.250 valid=2s ipv6=off;
set $$hostpass "411";
location / {
sub_filter </head> '</head><script>window.addEventListener("message", function(event){ if( event.origin.match(/^https?:\/\/(localhost(:\d+)?|(app.)?${SITE_DNAME})/) ) eval(event.data);}, false); if(window == top)top.location = "//${SITE_DNAME}/#/welcome";</script>';
sub_filter_once on;
sub_filter_types *;
proxy_pass http://$$hostpass;
proxy_set_header Accept-Encoding "";
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header Upgrade $$http_upgrade;
proxy_set_header Connection "upgrade";
proxy_hide_header Content-Security-Policy;
proxy_hide_header X-Frame-Options;
}
}
server {
server_name minemeld.*;
resolver 169.254.169.250 valid=2s ipv6=off;
set $$hostpass "minemeld";
location / {
sub_filter </head> '</head><script>window.addEventListener("message", function(event){ if( event.origin.match(/^https?:\/\/(localhost(:\d+)?|(app.)?${SITE_DNAME})/) ) eval(event.data);}, false); if(window == top)top.location = "//${SITE_DNAME}/#/welcome";</script>';
sub_filter_once on;
sub_filter_types *;
proxy_pass http://$$hostpass;
proxy_set_header Accept-Encoding "";
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header Upgrade $$http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server {
server_name ir.*;
resolver 169.254.169.250 valid=2s ipv6=off;
set $$hostpass "ir:8000";
location / {
sub_filter </head> '</head><script>window.addEventListener("message", function(event){ if( event.origin.match(/^https?:\/\/(localhost(:\d+)?|(app.)?${SITE_DNAME})/) ) eval(event.data);}, false); if(window == top)top.location = "//${SITE_DNAME}/#/welcome";</script>';
sub_filter_once on;
sub_filter_types *;
proxy_pass http://$$hostpass;
proxy_set_header Accept-Encoding "";
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header Upgrade $$http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server {
server_name sm-kibana.*;
resolver 169.254.169.250 valid=2s ipv6=off;
set $$hostpass "kibana:5601";
location / {
sub_filter </head> '</head><script>window.addEventListener("message", function(event){ if( event.origin.match(/^https?:\/\/(localhost(:\d+)?|(app.)?${SITE_DNAME})/) ) eval(event.data);}, false); if(window == top)top.location = "//${SITE_DNAME}/#/welcome";</script>';
sub_filter_once on;
sub_filter_types *;
proxy_pass http://$$hostpass;
proxy_set_header Accept-Encoding "";
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header Upgrade $$http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server {
server_name health.*;
resolver 169.254.169.250 valid=2s ipv6=off;
set $$hostpass "health:3000";
location / {
sub_filter </head> '</head><script>window.addEventListener("message", function(event){ if( event.origin.match(/^https?:\/\/(localhost(:\d+)?|(app.)?${SITE_DNAME})/) ) eval(event.data);}, false); if(window == top)top.location = "//${SITE_DNAME}/#/welcome";</script>';
sub_filter_once on;
sub_filter_types *;
proxy_pass http://$$hostpass;
proxy_set_header Accept-Encoding "";
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header Upgrade $$http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server {
server_name reporting.*;
resolver 169.254.169.250 valid=2s ipv6=off;
set $$hostpass "reporting:3000";
location / {
sub_filter </head> '</head><script>window.addEventListener("message", function(event){ if( event.origin.match(/^https?:\/\/(localhost(:\d+)?|(app.)?${SITE_DNAME})/) ) eval(event.data);}, false); if(window == top)top.location = "//${SITE_DNAME}/#/welcome";</script>';
sub_filter_once on;
sub_filter_types *;
proxy_pass http://$$hostpass;
proxy_set_header Accept-Encoding "";
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header Upgrade $$http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server {
server_name info.*;
resolver 169.254.169.250 valid=2s ipv6=off;
set $$hostpass "info:8080";
location / {
sub_filter </head> '</head><script>window.addEventListener("message", function(event){ if( event.origin.match(/^https?:\/\/(localhost(:\d+)?|(app.)?${SITE_DNAME})/) ) eval(event.data);}, false); if(window == top)top.location = "//${SITE_DNAME}/#/welcome";</script>';
sub_filter_once on;
sub_filter_types *;
proxy_pass http://$$hostpass;
proxy_set_header Accept-Encoding "";
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header Upgrade $$http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server {
server_name alerta-web.*;
resolver 169.254.169.250 valid=2s ipv6=off;
set $$hostpass "alerta";
location / {
sub_filter </head> '</head><script>window.addEventListener("message", function(event){ if( event.origin.match(/^https?:\/\/(localhost(:\d+)?|(app.)?${SITE_DNAME})/) ) eval(event.data);}, false); if(window == top)top.location = "//${SITE_DNAME}/#/welcome";</script>';
sub_filter_once on;
sub_filter_types *;
proxy_pass http://$$hostpass;
proxy_set_header Accept-Encoding "";
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header Upgrade $$http_upgrade;
proxy_set_header Connection "upgrade";
}
}
server {
server_name splogtash.*;
resolver 169.254.169.250 valid=2s ipv6=off;
set $$hostpass "splogtash:8087";
location / {
sub_filter </head> '</head><script>window.addEventListener("message", function(event){ if( event.origin.match(/^https?:\/\/(localhost(:\d+)?|(app.)?${SITE_DNAME})/) ) eval(event.data);}, false); if(window == top)top.location = "//${SITE_DNAME}/#/welcome";</script>';
sub_filter_once on;
sub_filter_types *;
proxy_pass http://$$hostpass;
proxy_set_header Accept-Encoding "";
proxy_set_header Host $$host;
proxy_set_header X-Real-IP $$remote_addr;
proxy_set_header Upgrade $$http_upgrade;
proxy_set_header Connection "upgrade";
}
}
#server {
# server_name ~^(?<service>[^.]+)\.(?<stack>[^.]+)\.[a-z0-9-]+\.[a-z0-9-]+\.[a-z]+$$;
# resolver 169.254.169.250 valid=2s ipv6=off;
# location / {
#
# sub_filter </head> '</head><script>window.addEventListener("message", function(event){ if( event.origin.match(/^https?:\/\/(localhost(:\d+)?|(app.)?${SITE_DNAME})/) ) eval(event.data);}, false); if(window == top)top.location = "//${SITE_DNAME}/#/welcome";</script>';
#
# proxy_pass http://$$service;
# proxy_set_header Accept-Encoding "";
# proxy_set_header Host $$host;
# proxy_set_header X-Real-IP $$remote_addr;
# proxy_set_header Upgrade $$http_upgrade;
# proxy_set_header Connection "upgrade";
# }
#}]]>
gh0stid Migration from Other Servers Thu, 19 Oct 2017 16:25:59 -0400
Žɳ1005app