Get the most out of your Centmin Mod LEMP stack
Become a Member

Prestashop 404 Not Found in a Prestashop moved server

Discussion in 'Ecommerce / Shopping cart usage' started by BLM, Aug 9, 2017.

  1. BLM

    BLM New Member

    18
    2
    3
    Jun 24, 2017
    Ratings:
    +3
    Local Time:
    7:07 PM
    As topic, i moved a Prestashop installation from an old server to this one.
    After moving files, import database, fix settings, when i try to connect to the main url i get just a page with "404 Not Found".

    Notice that i already moved that installation between other servers without any problem

     
  2. eva2000

    eva2000 Administrator Staff Member

    55,425
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,839
    Local Time:
    3:07 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    both same centmin mod branch with same nginx and php versions ?

    any clues in your access.log and error.log in vhost listed paths at
    Code (Text):
    access_log /home/nginx/domains/domain.com/log/access.log combined buffer=256k flush=60m;
    error_log /home/nginx/domains/domain.com/log/error.log;
    
     
  3. BLM

    BLM New Member

    18
    2
    3
    Jun 24, 2017
    Ratings:
    +3
    Local Time:
    7:07 PM
    This prestashop come from another different server: Webmin + Virtualmin (Apache).
    Error logs are empty

    Btw another question that i noticed just now: i saw that the SSL certificate now is "unsecure", i've to transfer the old certificate to the new server? Because i just recreated a new one using centmin opt 2 (add a vhost then chose to generate a let's encrypt certificate, did this with 12 domains and never had a problem, now i've this "unsecure" certificate). DNS records are ok
     
  4. eva2000

    eva2000 Administrator Staff Member

    55,425
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,839
    Local Time:
    3:07 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    For SSL old server's ssl certificate letsencrypt based or not ? did you transfer old server ssl cert AFTER creating centmin.sh menu option 2 ssl certificate or BEFORE ?

    There's generally 3 ways of setting up HTTPS SSL certificate for Centmin Mod Nginx HTTP/2 based HTTPS

    Method 1. The traditional way via centmin.sh menu option 2, 22 and selecting yes to self-signed ssl certificates first. Then converting the self-signed ssl certificate to paid or free (Letsencrypt) web browser trusted SSL certificates outlined at How to switch self-signed SSL certificate to paid SSL certificate ? You would still need to follow the same steps outlined at Nginx SPDY SSL Configuration for obtaining and purchasing the paid SSL certificate and most important part is the concatenation of the SSL provider provided filesto create the mentioned /usr/local/nginx/conf/ssl/domaincom/ssl-unified.crt and /usr/local/nginx/conf/ssl/domaincom/ssl-trusted.crtfiles referenced in your Nginx SSL vhost config file.

    You may need to also decide if you want to enable HTTP to HTTPS redirect outlined at How to force redirect from HTTP:// to HTTPS:// ?

    If you didn't answer yes at time of initial nginx vhost creation to self-signed ssl certificates, you can manually setup the self-signed ssl certificate via the vhost generator by checking self-signed ssl box and enter a domain name. This will outline instructions for manually creating and setting up self-signed ssl certificate and nginx vhost settings. Then for web browser trusted ssl certificates you switch follow - How to switch self-signed SSL certificate to paid SSL certificate ?.

    Method 2. Using and testing Centmin Mod 123.09beta01's new addons/acmetool.sh addon which is still in beta testing only for integrating Letsencrypt SSL certificates. And has both auto and manual methods.

    Method 3. Fully manual method for free Letsencrypt SSL certificates.
    Which method did you use ? centmin.sh menu option 2 creates self-signed untrusted ssl cert by default if you answer yes to ssl unless you enable letsencrypt in 123.09beta01 via LETSENCRYPT_DETECT='y' BEFORE running centmin.sh menu option 2. If your nginx vhost for domain is drastically different from standard centmin.sh menu option 2 created nginx vhost template i.e. if you transferred vhost from old non-centmin mod server, then acmetool.sh may not be able to properly setup your letsnecrypt ssl cert and validate the domain.

    How was the initial letsencrypt ssl certificate obtained ? Which method ?
    • Was the domain nginx vhost alreadying created prior or new domain nginx vhost site setup for first time ?
    • Via centmin.sh menu option 2, 22, /usr/bin/nv ?
    • If you ran centmin.sh menu option 2 or 22, which letsencrypt option did you select from
      Code (Text):
      -------------------------------------------------------------
      Setup full Nginx vhost + Wordpress + WP Plugins
      -------------------------------------------------------------
      
      Enter vhost domain name you want to add (without www. prefix): acme3.domain1.com
      
      Create a self-signed SSL certificate Nginx vhost? [y/n]: n
      Get Letsencrypt SSL certificate Nginx vhost? [y/n]: y
      
      You have 4 options:
      1. issue staging test cert with HTTP + HTTPS
      2. issue staging test cert with HTTPS default
      3. issue live cert with HTTP + HTTPS
      4. issue live cert with HTTPS default
      Enter option number 1-4: 1
      
    • Via addons/acmetool.sh ? which specific command ? examples
      Code (Text):
      ./acmetool.sh issue acme.domain.com
      
      Code (Text):
      ./acmetool.sh issue acme.domain.com live
      
      Code (Text):
      ./acmetool.sh issue acme.domain.com d
      
      Code (Text):
      ./acmetool.sh issue acme.domain.com lived
      
    • What was order of steps you did ? Did you run centmin.sh menu option 2 first with letsencrypt ? Then did you run addons/acmetool.sh afterwards ?

    Centmin Mod Self-Signed SSL Fallback



    If you're seeing a Centmin Mod's self-signed ssl certificate instead of letsencrypt ssl certificate, then that's acmetool.sh and centminmod's fallback if letsencrypt verification fails to obtain letsencrypt ssl cert, it falls back to centmin mod self-signed ssl certificate on https port 443 side so to preserve the https nginx vhost. For example if your old server non-centmin mod nginx vhost was used instead the letsencrypt validation may have failed and not be able to issue a letsencrypt ssl cert so you fall back to self-signed untrusted ssl cert.

    Troubleshooting



    There are various steps you can do to troubleshoot failed letsencrypt issuances, renews, reissues etc.
    • acmetool.sh logs all command line or shell menu runs to log files at /root/centminlogs. To troubleshoot, copy the contents of the log run and post contents of log to pastebin.com or gist.github.com and share link in this thread. To find the log list the logs in ascending date order
      Code (Text):
      ls -lahrt /root/centminlogs
      .
    • For direct acmetool.sh runs, there should be a 2nd & 3rd & 4th log in format /root/centminlogs/centminmod_${DT}_nginx_addvhost_nv.log and /root/centminlogs/acmetool.sh-debug-log-$DT.log and /root/centminlogs/acmesh-issue_*.log or /root/centminlogs/acmesh-reissue_*.log which would need to be included via separate pastebin.com or gist.github.com post.
    • Enable acmetool.sh debug mode. In persistent config file at /etc/centminmod/custom_config.inc (create it if doesn't exist) add and enable acmetool.sh debug mode which gives much more verbose letsencrypt issuance process information when you re-run acmetool.sh or centmin.sh menu options 2, 22 or /usr/bin/nv command lines.
      Code (Text):
      ACMEDEBUG='y'
    If acme.sh auto renewals didn't happen, check output for the following commands
    Code (Text):
    grep acme /var/log/cron* | sed -e "s|$(hostname -s)|host|g"
    

    Code (Text):
    echo y | /usr/local/src/centminmod/addons/acmetool.sh checkdates
    

    Code (Text):
    "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh"
    


    Without the answers to above questions and logs, there is nothing to help troubleshoot.

    404 error maybe if on Centmin Mod 123.09beta01, you may have ran into the new tools/autoprotect.sh cronjob feature outlined at Beta Branch - autoprotect.sh - apache .htaccess check & migration to nginx deny all | Centmin Mod Community You uploaded scripts may have .htaccess deny from all type files in their directories which may need bypassing autoprotect. It's a security feature that no other nginx based stack has as far as I know :)

    So instead, all .htaccess 'deny from all' detected directories now get auto generated Nginx equivalent location match and deny all setups except if you want to manually bypass the directory from auto protection via a .autoprotect-bypass file - details below here.

    You can read a few threads below on how autoprotect.sh may have caught some folks web apps falsely and the workarounds or improvements made to autoprotect.sh with the help of users feedback and troubleshooting.
     
  5. BLM

    BLM New Member

    18
    2
    3
    Jun 24, 2017
    Ratings:
    +3
    Local Time:
    7:07 PM
    Thanks for all these informations.

    About SSL certificate: i've around 12 Wordpress websites in this server (that i created using option 22, then chosing "yes" when asked for a SSL certificate, "yes" for Let's encrypt, then chosed option 4: live cert with https default), didn't had any problem at all. Now i created a domain for that Prestashop installation, so i used Option 2 (create a vhost), and as before i chosed to generate a Let's encrypt SSL certificate with option 4.

    That's why i don't understand why this certificate is "unsecure", i just created a new one using centmin, so i tought that the problem was that i had to transfer my old certificate (generated using Webmin) instead generate new one (some kind of conflict, i don't know), but i'm not sure since i never had a problem like that.


    About 404 error: i will try to fix it using this autoprotect script, but this can create some conflict with my wordpress installations? All my websites are from customers so i prefeer to don't risk
     
  6. eva2000

    eva2000 Administrator Staff Member

    55,425
    12,257
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,839
    Local Time:
    3:07 AM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    yes it could be an issue if you intend for customers to manage instead of you (or someone who understands the added security outlined at Wordpress - Wordpress 403 Permission Denied Errors)

    see troubleshooting steps outlined above that would be first step to take providing the debug logs and output for commands suggested