Hi,
I have a problem, and am unable to get what I want, even after many searches here and in Google.
Don't know if it is even possible.
I recently got a domainname ((www.)hanslammerts.nl). On this domainname I have a redirectservice that redirects every call to this domain to hanslammerts.servebeer.com.
On this server I have nginx running that serves several locations. Going directly to e.g. hanslammerts.servebeer.com/phpmyadmin works perfectly.
If I go to hanslammerts.nl/phpmyadmin, it does not work. I am being redirected to / instead of /phpmyadmin.
The first (and only) thing I do on the server definition for port 80, is to redirect everything to ssl.
Could this be my problem ?
My config for the site looks like this:
upstream php-handler {
#server 127.0.0.1:9000;
server unix:/var/run/php5-fpm.sock;
}
server {
listen 80;
server_name hanslammerts.servebeer.com;
# enforce https
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name hanslammerts.servebeer.com;
ssl_certificate /etc/letsencrypt/live/hanslammerts.servebeer.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/hanslammerts.servebeer.com/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
# Path to the root of your installation
root /var/www/html/;
# Add headers to serve security related headers
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
location ~ /.well-known {
allow all;
}
##################
# GateOne #
##################
location /gateone/ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://localhost:1443;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
##################
# phpmyadmin #
##################
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param HTTPS on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}
##################
# PHP stuff #
##################
location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
fastcgi_pass php-handler;
}
##################
# eGroupware #
##################
location /egroupware {
index index.php;
location ~ ^/egroupware/(.+\.php)$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param HTTPS on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
location /weewx/ {
index index.html;
}
}
In short:
All I want to achieve is for the URLs http://hanslammerts.nl/egroupware, http://hanslammerts.nl/weewx, etc. to be picked up by nginx running on hanslammerts.servebeer.com, redirect to ssl, and then go to the location of the URI, e.g. egroupware, weewx etc.
Is this at all possible ?
Hope someone can point me in the right direction.
Thank you,
Hans
I have a problem, and am unable to get what I want, even after many searches here and in Google.
Don't know if it is even possible.
I recently got a domainname ((www.)hanslammerts.nl). On this domainname I have a redirectservice that redirects every call to this domain to hanslammerts.servebeer.com.
On this server I have nginx running that serves several locations. Going directly to e.g. hanslammerts.servebeer.com/phpmyadmin works perfectly.
If I go to hanslammerts.nl/phpmyadmin, it does not work. I am being redirected to / instead of /phpmyadmin.
The first (and only) thing I do on the server definition for port 80, is to redirect everything to ssl.
Could this be my problem ?
My config for the site looks like this:
upstream php-handler {
#server 127.0.0.1:9000;
server unix:/var/run/php5-fpm.sock;
}
server {
listen 80;
server_name hanslammerts.servebeer.com;
# enforce https
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl;
server_name hanslammerts.servebeer.com;
ssl_certificate /etc/letsencrypt/live/hanslammerts.servebeer.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/hanslammerts.servebeer.com/privkey.pem;
ssl_session_timeout 5m;
ssl_protocols TLSv1;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
# Path to the root of your installation
root /var/www/html/;
# Add headers to serve security related headers
add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;";
location ~ /.well-known {
allow all;
}
##################
# GateOne #
##################
location /gateone/ {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass_header Server;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Scheme $scheme;
proxy_pass http://localhost:1443;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
##################
# phpmyadmin #
##################
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+\.php)$ {
try_files $uri =404;
root /usr/share/;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param HTTPS on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
root /usr/share/;
}
}
location /phpMyAdmin {
rewrite ^/* /phpmyadmin last;
}
##################
# PHP stuff #
##################
location ~ \.php(?:$|/) {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param HTTPS on;
fastcgi_pass php-handler;
}
##################
# eGroupware #
##################
location /egroupware {
index index.php;
location ~ ^/egroupware/(.+\.php)$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param HTTPS on;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include /etc/nginx/fastcgi_params;
}
}
location /weewx/ {
index index.html;
}
}
In short:
All I want to achieve is for the URLs http://hanslammerts.nl/egroupware, http://hanslammerts.nl/weewx, etc. to be picked up by nginx running on hanslammerts.servebeer.com, redirect to ssl, and then go to the location of the URI, e.g. egroupware, weewx etc.
Is this at all possible ?
Hope someone can point me in the right direction.
Thank you,
Hans