ISPConfig with Nginx Proxy rewrite problem.

Discussion in 'Installation/Configuration' started by simonfr, Dec 4, 2015.

  1. simonfr

    simonfr New Member

    Hi all,
    I'm trying since some days to resolve problems with my website. It's based on Zend Framework 2. I'm using ISPConfig Perfect Server for Debian 8 with Nginx Proxy with this tutorial : https://www.howtoforge.com/nginx-ca...end-to-apache-for-ispconfig-3-on-debian-lenny.

    My website have all his content in folder /plugins/. When I'm trying to access to http://mydomain.com:82/ it works great but when I'm trying to access to http://mydomain.com/ I see only index.php without style.css. I've tried to access http://mydomain.com/public/css/style.css I get 404 error but when I'm trying to http://mydomain.com:82/public/css/style.css It works.

    Here is my .htaccess :
    Code:
    SetEnv APPLICATION_ENV development
    
    # Set the charset of the output
    AddDefaultCharset UTF-8
    
    ## EXPIRES CACHING ##
    ExpiresActive On
    ExpiresByType image/jpg "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType application/pdf "access plus 1 month"
    ExpiresByType text/x-javascript "access plus 1 month"
    ExpiresByType application/x-shockwave-flash "access plus 1 month"
    ExpiresByType image/x-icon "access plus 1 year"
    ExpiresDefault "access plus 2 days"
    
    ## EXPIRES CACHING ##
    
    RewriteEngine On
    
    # Exclude some directories from URI rewriting
    #RewriteRule ^(dir1|dir2|dir3) - [L]
    
    RewriteRule ^(chat|svn) - [L]
    
    RewriteRule ^\.htaccess$ - [F]
    
    RewriteCond %{REQUEST_URI} =""
    RewriteRule ^.*$ /public/index.php [NC,L]
    
    RewriteCond %{REQUEST_URI} !^/public/.*$
    RewriteRule ^(.*)$ /public/$1
    
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^.*$ - [NC,L]
    
    RewriteRule ^public/.*$ /public/index.php [NC,L]
    
    And here my default vhost from NGINX :
    Code:
    server {
            listen   80 default;
            server_name  _;
            server_name_in_redirect  off;
            resolver  127.0.0.1;
            }
    
            access_log  /var/log/ispconfig/httpd/$host/access.log;
            location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|b$
                    root   /var/www/$host/web;
                    access_log off;
                    expires 30d;
            }
    
            location / {
                    root    /var/www/$host/web;
                    index  index.html index.htm index.php;
                    access_log      off;
                    proxy_pass http://127.0.0.1:82;
                    proxy_set_header X-Real-IP  $remote_addr;
                    proxy_set_header Host $host;
                    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            }
    
    }
    
    server {
            server_name XXX.XXX.XXX.XXX;
    
            add_header X-Frame-Options "SAMEORIGIN";
            return 301 $scheme://www.mydomain.com$request_uri;
    }
    Can you help me to resolve this ?
    Best regards,
    Thank you
     

Share This Page