Announcement

Collapse
No announcement yet.

NGINX configuration access to portal with subdomain

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NGINX configuration access to portal with subdomain

    Hello,
    I'm trying to access to subdomain.domain.com instead of domain.com/portal
    I'm with a nginx server.
    I have search on this forum , on docs : https://www.espocrm.com/documentatio...ration/portal/, on nginx configuration but nothing.
    I have spend already 2 days on it.
    Can someone help me please ?
    Thanks

  • #2
    Please I really nead help.
    tanya Maximus or littlegeorge
    Thanks for your time

    Comment


    • #3
      I try to ask again. Do you have an idea, it has been 2 days I try some different case, but nothing.
      Please and thanks

      Comment


      • #4
        Hi,
        I have found the solution : Just say thanks in reply if you have the problem
        First : be sure you have this :
        Code:
        fastcgi_param REDIRECT_URL $request_uri;
        in your server ningx conf file
        Code:
        location ~ \.php$ {
                    try_files $uri =404;
                    fastcgi_pass unix:/run/php/php7.2-fpm.sock;
                     fastcgi_index index.php;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include fastcgi_params;
                    fastcgi_intercept_errors on;
                    fastcgi_ignore_client_abort off;
                    fastcgi_connect_timeout 60;
                    fastcgi_send_timeout 180;
                    fastcgi_read_timeout 180;
                    fastcgi_buffers 4 256k;
                    fastcgi_buffer_size 128k;
                    fastcgi_busy_buffers_size 256k;
                    fastcgi_temp_file_write_size 256k;
                    fastcgi_param REDIRECT_URL $request_uri;
                }
        Second :
        This is all the config file :
        Code:
        server {
                listen 80;
                server_name portail.mydomain.fr;
                rewrite ^ https://$server_name$request_uri? permanent;
        }
        
        server {
                listen 443 ssl;
                server_name portail.mydomain.fr;
                root /var/www/mydomain.fr/web/ESPOCRM;
        
                access_log /var/log/nginx/portail.mydomain-access.log combined;
                error_log /var/log/nginx/portail.mydomain-error.log error;
        
                include /etc/nginx/conf.d/proxy-control.conf;
                include /etc/nginx/conf.d/ssl.conf;
        
                index index.php index.html index.htm;
                charset utf-8;
                client_max_body_size 100M;
        
                location ~ \.php$ {
                    try_files $uri =404;
                    fastcgi_pass unix:/run/php/php7.2-fpm.sock;
                     fastcgi_index index.php;
                    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
                    include fastcgi_params;
                    fastcgi_intercept_errors on;
                    fastcgi_ignore_client_abort off;
                    fastcgi_connect_timeout 60;
                    fastcgi_send_timeout 180;
                    fastcgi_read_timeout 180;
                    fastcgi_buffers 4 256k;
                    fastcgi_buffer_size 128k;
                    fastcgi_busy_buffers_size 256k;
                    fastcgi_temp_file_write_size 256k;
                    fastcgi_param REDIRECT_URL $request_uri;
                }
        
            location /client {
                rewrite ^/client/(.*) /client/$1 break;
            }
        
            location / {
                rewrite ^/(.*)$ /portal/ last; break;
            }
        
            location /api/v1/ {
                if (!-e $request_filename){
                    rewrite ^/api/v1/(.*)$ /api/v1/index.php last; break;
                }
            }
        
            location /portal/ {
                try_files $uri $uri/ /portal/index.php;
            }
        
            location /api/v1/portal-access {
                if (!-e $request_filename){
                    rewrite ^/api/v1/(.*)$ /api/v1/portal-access/index.php last; break;
                }
            }
        
            location ~ /reset/?$ {
                try_files /reset.html =404;
            }
        
            location ^~ (data|api)/ {
                if (-e $request_filename){
                    return 403;
                }
            }
            location ^~ /data/logs/ {
                deny all;
            }
            location ^~ /data/\.backup/ {
                deny all;
            }
            location ^~ /data/config.php {
                deny all;
            }
            location ^~ /data/cache/ {
                deny all;
            }
            location ^~ /data/upload/ {
                deny all;
            }
            location ^~ /application/ {
                deny all;
            }
            location ^~ /custom/ {
                deny all;
            }
            location ^~ /vendor/ {
                deny all;
            }
            location ~ /\.ht {
                deny all;
            }
        
        
        }

        Comment

        Working...
        X