Welcome! Log In Create A New Profile

Advanced

Re: Two domains and multiple server blocks

basti
August 12, 2017 04:18AM
Hello,

your server_name .3jgkp.de; and server_name .armapedia.de;
are wrong. Use www.armapedia.de, wildcard, regex or whatever.
See http://nginx.org/en/docs/http/server_names.html

Best Regards,
Basti


On 12.08.2017 09:21, Jamesadamar wrote:
> Dear community,
>
> I am a beginner in the land of nginx and server administration. From what
> I've read so far, setting up nginx to listen to two domains is fairly easy.
> All it needs are two distinct server blocks listen to port 80 and with
> server_name identical to the domains in question. But it will not work.
>
> I have to domains: www.3jgkp.de and www.armapedia.de. Both a registered by
> www.inwx.de and both have A DNS entries to the same server IP 88.99.227.139,
> which is my server. For 3.jgkp I use one additional subdomain wiki.3jgkp.de,
> which also redirects to this IP.
>
> Now it should suffice to have
>
> server {
> listen 80;
> listen [::]:80;
>
> server_name .3jgkp.de;
>
> index index.html index.htm index.php;
>
> ....
> }
>
> server {
> listen *:80;
> listen [::]:80;
>
> server_name wiki.3jgkp.de;
> return 301 https://wiki.3jgkp.de$request_uri;
>
> ....
>
> }
>
> server {
> listen *:443 ssl;
> server_name wiki.3jgkp.de;
>
> index index.php;
> root /var/www/wiki/drupal-8.2.6; ## <-- Your only path reference.
> client_max_body_size 10m;
> ssl_certificate /etc/letsencrypt/live/wiki.3jgkp.de-0001/fullchain.pem;
> # managed by Certbot
> ssl_certificate_key
> /etc/letsencrypt/live/wiki.3jgkp.de-0001/privkey.pem; # managed by Certbot
>
> ....
> }
>
> for www.3jgkp.de -> that works, both directories are delivered. However,
> www.armapedia.de does NOT work:
>
> server {
> listen 80;
> listen [::]:80;
> server_name .armapedia.de;
> return 301 https://www.armapedia.de$request_uri;
>
> }
>
> server {
> listen 443 ssl;
> server_name www.armapedia.de;
>
> root /var/www/armapedia/; ## <-- Your only path reference.
> access_log /var/log/nginx/armapedia.de.access.log;
> error_log /var/log/nginx/armapedia.de.error.log;
>
> ssl_certificate /etc/letsencrypt/live/www.armapedia.de/fullchain.pem; #
> managed by Certbot
> ssl_certificate_key /etc/letsencrypt/live/www.armapedia.de/privkey.pem;
> # managed by Certbot
> include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
> }
>
> Here, whenever I enter www.armapedia.de in my browser, I am redirected to
> armapedia.3jgkp.de. I dont understand this behavior at all. All examples
> about nginx and multiple vhosts with different domains just use the
> appropriate server_name entries, so I'm really stuck here.
>
> Thank you for your help
>
> Posted at Nginx Forum: https://forum.nginx.org/read.php?2,276031,276031#msg-276031
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Two domains and multiple server blocks

Jamesadamar August 12, 2017 03:21AM

Re: Two domains and multiple server blocks

basti August 12, 2017 04:18AM

Re: Two domains and multiple server blocks

Jamesadamar August 12, 2017 05:08AM

RE: Two domains and multiple server blocks

Reinis Rozitis August 12, 2017 09:00AM

RE: Two domains and multiple server blocks

Iurii Medvedev August 12, 2017 09:04AM

RE: Two domains and multiple server blocks

Reinis Rozitis August 12, 2017 09:12AM

Re: Two domains and multiple server blocks

Iurii Medvedev August 12, 2017 09:18AM

RE: Two domains and multiple server blocks

Reinis Rozitis August 12, 2017 09:28AM

Re: RE: Two domains and multiple server blocks

Jamesadamar August 12, 2017 11:07AM

RE: RE: Two domains and multiple server blocks

Reinis Rozitis August 12, 2017 04:02PM

Re: RE: RE: Two domains and multiple server blocks

Jamesadamar August 12, 2017 04:09PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 106
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready