nginx 1.2.1 and joomla rewrites

Discussion in 'ISPConfig 3 Priority Support' started by pinkfeet, Feb 6, 2015.

  1. pinkfeet

    pinkfeet New Member HowtoForge Supporter

    Hi,
    anyone would be so kind to help me with this please ?
    I'm trying to use friendly URLs with Rewrites and joomla. I followed this joomla's guide but finally i didn't be able to do it:
    https://docs.joomla.org/Enabling_Search_Engine_Friendly_(SEF)_URLs#Nginx
    Exactly:
    # Support Clean (aka Search Engine Friendly) URLs
    location / {
    try_files $uri $uri/ /index.php?q=$request_uri;
    }
    I'm using Debian wheezy with nginx package version 1.2.1 and i think that could be the problem, is there a way to use a newer nginx version in wheezy ? I'm thinking in to compile a newer nginx version but i'm worry to create more problems than solutions with actual packages like php, etc...in the process. Do you recommend me this way ?

    Thanks in advance.

    Regards
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Your nginx version is not the problem.

    Add the following lines into the nginx directives field of the website in ispconfig:

    Code:
    # deny running scripts inside writable directories
      location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
      return 403;
      error_page 403 /403_error.html;
      }
      location / {
      try_files $uri $uri/ /index.php?q=$uri&$args;
      }
      # caching of files
      location ~* \.(ico|pdf|flv)$ {
      expires 1y;
      }
      location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
      expires 14d;
      }
    
     
    inside83 likes this.
  3. Aerobaticrug

    Aerobaticrug New Member

    Hi Till, I am having this very issue. ISPConfig 3.05.4p5 on debian wheezy with nginx. I have added the above to the site directives.
    When i enable SEF url and then click on one link on my site it returns the .index.html page from the root directory. This is currently redirected to our forum site whilst we build the joomla site. You can see what I mean if you go to www.racing-leagues.com/home then click on regulations or any of the other links apart from forums.

    Would really like to get this working!
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Your joomla seems to be installed in a subdirectory, the above rules are for a install in the web directory. You will have to change all rules to match your differet install path. Try this one (untested):

    Code:
    # deny running scripts inside writable directories
    location ~* /home/(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ {
    return 403;
    error_page 403 /403_error.html;
    }
    location /home/ {
    try_files $uri $uri/home/ /home/index.php?q=$uri&$args;
    }
    # caching of files
    location ~* \.(ico|pdf|flv)$ {
    expires 1y;
    }
    location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
    expires 14d;
    }
    
    
     
    Michel Zuniga and Aerobaticrug like this.
  5. Aerobaticrug

    Aerobaticrug New Member

    Awesome, thanks so much, that worked a treat :)
     

Share This Page