Hosting EspoCRM @ one.com: .htaccess problems...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rvorsten
    Junior Member
    • Mar 2022
    • 8

    Hosting EspoCRM @ one.com: .htaccess problems...

    Good day folks -

    Has anyone been successful in hosting EspoCRM at one.com?

    I have been running a very basic EspoCRM instance for our home community on my SynologyNAS. Works like a charm, but it's a bit slow and it eats my NAS resources too. We do have a paid plan at one.com, giving us the domain name, (NGINX) hosting & (MariaDB) database capabilities. So it seemed an easy task to move it all to one.com. Well, not so much...

    I managed to migrate the database successfully. Also managed to move the website folder from my server to one.com via sftp. Edited the config file to make it point to the 'now one.com hosted' database. But when I try to access my site: no luck. I see a notification page saying that I need to make changes to the nginx configuration (which one.com does not allow), or use a .htaccess in case of Apache server.

    I have also tried a clean install of EspoCRM (incl the DB) but no luck. One.com helpdesk isn't of much help: they only tell me that they don't know EspoCRM and advise me to "use an .htaccess file" and that's where I get stuck.

    Any suggestions/experiences?

    Many thanks,
    Ronald
  • esforim
    Active Community Member
    • Jan 2020
    • 2204

    #2
    I look at their website and it seem they can only do Website, it doesn't seem be able to do anything else ?

    I'm not too use of nginx, as most here here use Apache/PHP I believe. There a few docker and other odd-ball like nginx, etc but not many.

    I don't think you can use one.com, but I could be wrong.

    An article teaching how to determine the best web hosting solution for your needs, even if you own a small business. It includes WordPress.

    Comment

    • rvorsten
      Junior Member
      • Mar 2022
      • 8

      #3
      Thanks for responding!

      Yes, one can host a website there. I have a folder where I have installed the EspoCRM code. I also have a MariaDB server available. When I upload EspoCRM for a clean install and I access the website http://<mywebsite>.com, it redirects me to http://<mywebsite>.com/public/

      and I get an error message:

      Click image for larger version

Name:	Screenshot 2023-05-19 at 16.03.21.png
Views:	309
Size:	17.0 KB
ID:	92696
      This is caused by the .htaccess that comes with the clean install. It seems that .htaccess as it is, is preventing me from accessing the /public folder

      Below is the code in .htaccess, as it comes out of the box, and that actually seems to forbid the /public/ folder. So the question is: what changes must I make to .htaccess to make EspoCRM work...


      Code:
      <ifModule mod_headers.c>
      Header always set Access-Control-Allow-Methods "POST, GET, PUT, PATCH, DELETE"
      </ifModule>
      
      DirectoryIndex index.php
      
      Options -Indexes
      
      <IfModule mod_rewrite.c>
      RewriteEngine On
      
      # Forbid access. Not actual as redirect to `public` is applied.
      # An extra security measure if redirect not fired.
      RewriteRule ^/?data/ - [F]
      RewriteRule ^/?application/ - [F]
      RewriteRule ^/?custom/ - [F]
      RewriteRule ^/?vendor/ - [F]
      RewriteRule /?web\.config - [F]
      
      # Forbid `public` dir.
      RewriteCond %{ENV:REDIRECT_STATUS} !=200
      RewriteRule ^/?public/? - [F,L]
      
      # Skip redirect for `client` dir.
      RewriteRule ^client/ - [L]
      
      # Store base path.
      RewriteCond %{REQUEST_URI}::$1 ^(.*?/)(.*)::\2$
      RewriteRule ^(.*)$ - [E=BASE:%1]
      
      # Add trailing slash.
      RewriteCond %{DOCUMENT_ROOT}/%{ENV:BASE}/public/$1 -d
      RewriteRule ^(.*?[^/])$ %{REQUEST_URI}/ [L,R=301,NE]
      
      # Rewrite to `public` dir.
      RewriteRule ^((?!public/).*)$ %{ENV:BASE}/public/$1 [L,NC]
      
      RewriteRule .* - [E=HTTP_ESPO_CGI_AUTH:%{HTTP:Authorization}]
      </IfModule>
      ​
      Many thanks, Ronald
      Attached Files

      Comment

      • bandtank
        Active Community Member
        • Mar 2017
        • 379

        #4
        Did you ever figure this out? I'm having the same issue with a clone of the repo. If I add /public to the DocumentRoot of the Apache configuration, the assets in the client folder won't load. If I point the configuration to the root folder, everything works fine.

        Comment

        Working...