Domains not working as expected with nginx

Jason Crews jason.crews at gmail.com
Fri Jul 8 19:53:39 UTC 2022


server_tokens off;

# server_names_hash_bucket_size 64;

# server_name_in_redirect off;

ssl_prefer_server_ciphers on;

# server {

# listen     localhost:110;

# server {

# listen     localhost:143;

server {

listen 127.0.0.2:80;

server_name 127.0.0.2;

        server unix:/tmp/php-cgi.socket;

        server 127.0.0.1:9000;

server {

        server_name secondarydomain.com;

fastcgi_param  SERVER_PROTOCOL    $server_protocol;

fastcgi_param  SERVER_ADDR        $server_addr;

fastcgi_param  SERVER_PORT        $server_port;

fastcgi_param  SERVER_NAME        $server_name;

server {

    listen 443 ssl http2;

    listen [::]:443 ssl http2;

    ssl_prefer_server_ciphers off;

    server_name sub.maindomain.com;

server {

    listen 80 default_server;

    listen [::]:80 default_server;

server {

    listen 443 ssl http2;

    listen [::]:443 ssl http2;

    ssl_prefer_server_ciphers off;

    server_name primarydomain.com www.primarydomain.com;

        fastcgi_pass 127.0.0.1:9000; # or whatever port your PHP-FPM listens on

    #        fastcgi_pass 127.0.0.1:9000; # or whatever port your
PHP-FPM listens on


Jason Crews

On Fri, Jul 8, 2022 at 11:07 AM Francis Daly <francis at daoine.org> wrote:
>
> On Fri, Jul 08, 2022 at 10:14:13AM -0700, Jason Crews wrote:
>
> Hi there,
>
> > I'm not sure what I've got misconfigured here, I would appreciate
> > anyone who could point me in the right direction.
> > Site structure:
> >
> > maindomain.com -> mediawiki -> works
> > sub.maindomain.com -> basic php website -> works
> > secondarydomain.com -> wordpress -> goes to sub.maindomain.com
> >
> > I've posted all of the config files on reddit:
> > https://www.reddit.com/r/nginx/comments/vtuha9/domains_not_going_where_expected/
>
> For each server{} block that you have, what are the "listen" directives
> and what are the "server_name" directives.
>
>     $ nginx -T | grep 'server\|listen'
>
> will probably give a reasonable starting point for that data. Feel
> free to edit it to hide anything you consider private; but please be
> consistent. If you use the same IP address in the config twice, edit it
> to the same thing. If you use different IP addresses, edit them to be
> different things -- anything in the 10.x network is "private enough".
>
> And for server_name entries, one.example.com, two.examle.com, and
> *.example.net might be reasonable ways to edit thing.
>
> (Also: feel free not to change things if you don't consider them private.)
>
> And when you report something not working, please be specific about http
> or https, to which particular hostname.
>
> (And confirm whether the hostname resolves to the IP address that nginx
> is listening on.)
>
> Hopefully the answers to those will make it clear what is happening,
> and what should be changed to make things happen the way you want them
> to happen.
>
> Cheers,
>
>         f
> --
> Francis Daly        francis at daoine.org
> _______________________________________________
> nginx mailing list -- nginx at nginx.org
> To unsubscribe send an email to nginx-leave at nginx.org



More information about the nginx mailing list