Submitted by dfrm on Thu, 01/18/2018 - 08:29
Hello,
I am trying to set up alias for my domains the thing is:
Main domain: domain.eu -> root for this is home/domain/
Aliases: domain.de, domain.fr
Nginx config of aliases:
server {
server_name domain.de www.domain.de;
listen xxx.xxx.xxx.xxx;
root /home/domain/public_html;
index index.html index.htm index.php;
access_log /var/log/virtualmin/domain.de_access_log;
error_log /var/log/virtualmin/domain.de_error_log;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME /home/domain/public_html$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT /home/domain/public_html;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param HTTPS $https;
location ~ \.php$ {
try_files $uri =404;
#fastcgi_pass unix:/var/php-nginx/15161112352697.sock/socket;
fastcgi_pass unix:/var/php-nginx/14892222483561.sock/socket; -> this is same as defined in domain.eu
}
listen 93.170.77.172:443 ssl;
ssl_certificate /home/domain.de/ssl.cert;
ssl_certificate_key /home/domain.de/ssl.key;
}
I want to know if it is good solution or if there is any other way to do this
Status:
Active
Comments
Submitted by dfrm on Thu, 01/18/2018 - 09:43 Comment #1
Ok I gave up on this solution. I added it as an alias. But I have problem with ssl redirect. I have this rule in the config:
server_name prohormones.eu www.prohormones.eu prohormones.hu www.prohormones.hu;
listen 93.170.77.42;
if ($scheme != "https") {
rewrite ^ https://prohormones.eu$uri permanent;
}
How can I change .eu to the current server????
Submitted by dfrm on Thu, 01/18/2018 - 10:50 Comment #2
I got it working with this but I need to remove www. From $host
if ($scheme != "https") {
rewrite ^ https://$host$uri permanent;
}
Submitted by Kintaro on Thu, 01/25/2018 - 02:29 Comment #3
Have you tried to set to YES this:
Webmin=>Servers=>Virtualmin Virtual Servers=> SSL Settings=>Redirect HTTP to HTTPS by default?
instead of put a redirect inside every vhost configuration?