website 404 Not Found from some locations











up vote
1
down vote

favorite












I have migrated a website from physical server running apache to a virtual machine running nginx.



When I go to website direct link, website is up : http://www.via-ap.com



but when I go to Google and if I click on website on right panel, I get a 404 error.



see picture here



see below :




https://www.google.fr/search?ei=Ri3jW4TXDZGalwSL46vQAQ&q=via+ap&oq=via+ap&gs_l=psy-ab.3...4929.5483.0.5646.6.5.0.0.0.0.0.0..0.0....0...1c.1.64.psy-ab..6.0.0....0.76V4PDLEtNM




I did these tests from many browsers and from private mode.



my default nginx vhost conf is :



server {
server_name _;
listen 80 default_server;
listen 443 ssl default_server;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
return 404;
}


and then each website have his own conf like this below :



server {
listen 80;
listen [::]:80;
server_name website.com;
return 301 https://www.$host$request_uri;
}

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.website.com website.com;
root /home/website/www/;
index index.html index.htm index.php;

access_log /var/log/nginx/website.access_log;
error_log /var/log/nginx/website.error_log info;

location ~ .php$ {
fastcgi_pass unix:/var/run/php/php7.2-fpm-website.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

include /etc/nginx/conf/website.conf; /* file where strict transport security headers are defined */

ssl_certificate /etc/letsencrypt/live/website.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/website.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/website.com/chain.pem;

include /etc/nginx/conf/ssl.conf;
}


Do you know why?



Thanks
L.










share|improve this question
























  • Bonjour! When you position your mouse cursor on the "Site Web" button, what address does it show in the bottom address bar? Is it what you expect? The error might be there and not your server.
    – Nic3500
    Nov 7 at 18:45










  • when mouse is over button, the right link is displayed....that's why this is crazy :-/
    – TooNetCreation
    Nov 7 at 19:20















up vote
1
down vote

favorite












I have migrated a website from physical server running apache to a virtual machine running nginx.



When I go to website direct link, website is up : http://www.via-ap.com



but when I go to Google and if I click on website on right panel, I get a 404 error.



see picture here



see below :




https://www.google.fr/search?ei=Ri3jW4TXDZGalwSL46vQAQ&q=via+ap&oq=via+ap&gs_l=psy-ab.3...4929.5483.0.5646.6.5.0.0.0.0.0.0..0.0....0...1c.1.64.psy-ab..6.0.0....0.76V4PDLEtNM




I did these tests from many browsers and from private mode.



my default nginx vhost conf is :



server {
server_name _;
listen 80 default_server;
listen 443 ssl default_server;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
return 404;
}


and then each website have his own conf like this below :



server {
listen 80;
listen [::]:80;
server_name website.com;
return 301 https://www.$host$request_uri;
}

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.website.com website.com;
root /home/website/www/;
index index.html index.htm index.php;

access_log /var/log/nginx/website.access_log;
error_log /var/log/nginx/website.error_log info;

location ~ .php$ {
fastcgi_pass unix:/var/run/php/php7.2-fpm-website.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

include /etc/nginx/conf/website.conf; /* file where strict transport security headers are defined */

ssl_certificate /etc/letsencrypt/live/website.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/website.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/website.com/chain.pem;

include /etc/nginx/conf/ssl.conf;
}


Do you know why?



Thanks
L.










share|improve this question
























  • Bonjour! When you position your mouse cursor on the "Site Web" button, what address does it show in the bottom address bar? Is it what you expect? The error might be there and not your server.
    – Nic3500
    Nov 7 at 18:45










  • when mouse is over button, the right link is displayed....that's why this is crazy :-/
    – TooNetCreation
    Nov 7 at 19:20













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have migrated a website from physical server running apache to a virtual machine running nginx.



When I go to website direct link, website is up : http://www.via-ap.com



but when I go to Google and if I click on website on right panel, I get a 404 error.



see picture here



see below :




https://www.google.fr/search?ei=Ri3jW4TXDZGalwSL46vQAQ&q=via+ap&oq=via+ap&gs_l=psy-ab.3...4929.5483.0.5646.6.5.0.0.0.0.0.0..0.0....0...1c.1.64.psy-ab..6.0.0....0.76V4PDLEtNM




I did these tests from many browsers and from private mode.



my default nginx vhost conf is :



server {
server_name _;
listen 80 default_server;
listen 443 ssl default_server;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
return 404;
}


and then each website have his own conf like this below :



server {
listen 80;
listen [::]:80;
server_name website.com;
return 301 https://www.$host$request_uri;
}

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.website.com website.com;
root /home/website/www/;
index index.html index.htm index.php;

access_log /var/log/nginx/website.access_log;
error_log /var/log/nginx/website.error_log info;

location ~ .php$ {
fastcgi_pass unix:/var/run/php/php7.2-fpm-website.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

include /etc/nginx/conf/website.conf; /* file where strict transport security headers are defined */

ssl_certificate /etc/letsencrypt/live/website.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/website.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/website.com/chain.pem;

include /etc/nginx/conf/ssl.conf;
}


Do you know why?



Thanks
L.










share|improve this question















I have migrated a website from physical server running apache to a virtual machine running nginx.



When I go to website direct link, website is up : http://www.via-ap.com



but when I go to Google and if I click on website on right panel, I get a 404 error.



see picture here



see below :




https://www.google.fr/search?ei=Ri3jW4TXDZGalwSL46vQAQ&q=via+ap&oq=via+ap&gs_l=psy-ab.3...4929.5483.0.5646.6.5.0.0.0.0.0.0..0.0....0...1c.1.64.psy-ab..6.0.0....0.76V4PDLEtNM




I did these tests from many browsers and from private mode.



my default nginx vhost conf is :



server {
server_name _;
listen 80 default_server;
listen 443 ssl default_server;
ssl_certificate /etc/nginx/ssl/nginx.crt;
ssl_certificate_key /etc/nginx/ssl/nginx.key;
return 404;
}


and then each website have his own conf like this below :



server {
listen 80;
listen [::]:80;
server_name website.com;
return 301 https://www.$host$request_uri;
}

server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name www.website.com website.com;
root /home/website/www/;
index index.html index.htm index.php;

access_log /var/log/nginx/website.access_log;
error_log /var/log/nginx/website.error_log info;

location ~ .php$ {
fastcgi_pass unix:/var/run/php/php7.2-fpm-website.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

include /etc/nginx/conf/website.conf; /* file where strict transport security headers are defined */

ssl_certificate /etc/letsencrypt/live/website.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/website.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/website.com/chain.pem;

include /etc/nginx/conf/ssl.conf;
}


Do you know why?



Thanks
L.







apache web nginx caching http-status-code-404






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 7 at 19:28

























asked Nov 7 at 18:25









TooNetCreation

125




125












  • Bonjour! When you position your mouse cursor on the "Site Web" button, what address does it show in the bottom address bar? Is it what you expect? The error might be there and not your server.
    – Nic3500
    Nov 7 at 18:45










  • when mouse is over button, the right link is displayed....that's why this is crazy :-/
    – TooNetCreation
    Nov 7 at 19:20


















  • Bonjour! When you position your mouse cursor on the "Site Web" button, what address does it show in the bottom address bar? Is it what you expect? The error might be there and not your server.
    – Nic3500
    Nov 7 at 18:45










  • when mouse is over button, the right link is displayed....that's why this is crazy :-/
    – TooNetCreation
    Nov 7 at 19:20
















Bonjour! When you position your mouse cursor on the "Site Web" button, what address does it show in the bottom address bar? Is it what you expect? The error might be there and not your server.
– Nic3500
Nov 7 at 18:45




Bonjour! When you position your mouse cursor on the "Site Web" button, what address does it show in the bottom address bar? Is it what you expect? The error might be there and not your server.
– Nic3500
Nov 7 at 18:45












when mouse is over button, the right link is displayed....that's why this is crazy :-/
– TooNetCreation
Nov 7 at 19:20




when mouse is over button, the right link is displayed....that's why this is crazy :-/
– TooNetCreation
Nov 7 at 19:20












1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










solution found.
on first server block (listen 80)




  • as you said first, I have added www.website.com in addition to website.com


  • then I have replaced return 301 https://www.$host$request_uri; by return 301 https://$host$request_uri;







share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53195571%2fwebsite-404-not-found-from-some-locations%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    solution found.
    on first server block (listen 80)




    • as you said first, I have added www.website.com in addition to website.com


    • then I have replaced return 301 https://www.$host$request_uri; by return 301 https://$host$request_uri;







    share|improve this answer

























      up vote
      0
      down vote



      accepted










      solution found.
      on first server block (listen 80)




      • as you said first, I have added www.website.com in addition to website.com


      • then I have replaced return 301 https://www.$host$request_uri; by return 301 https://$host$request_uri;







      share|improve this answer























        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        solution found.
        on first server block (listen 80)




        • as you said first, I have added www.website.com in addition to website.com


        • then I have replaced return 301 https://www.$host$request_uri; by return 301 https://$host$request_uri;







        share|improve this answer












        solution found.
        on first server block (listen 80)




        • as you said first, I have added www.website.com in addition to website.com


        • then I have replaced return 301 https://www.$host$request_uri; by return 301 https://$host$request_uri;








        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 7 at 20:25









        TooNetCreation

        125




        125






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53195571%2fwebsite-404-not-found-from-some-locations%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Hercules Kyvelos

            Tangent Lines Diagram Along Smooth Curve

            Yusuf al-Mu'taman ibn Hud