Difference between revisions of "Joomla Nginx Config"

From Tech Wiki
Jump to navigation Jump to search
(Created page with "'''Here is the Nginx Config for Joomla:''' <pre> upstream examplecombackend { server unix:/var/run/php-fcgi-examplecom.sock; } server { listen 80; se...")
 
 
Line 48: Line 48:
 
</pre>
 
</pre>
  
 +
[[Category:Joomla]]
 
[[Category:Nginx]]
 
[[Category:Nginx]]
 
[[Category:Linux]]
 
[[Category:Linux]]
 
[[Category:Contents]]
 
[[Category:Contents]]

Latest revision as of 17:26, 30 April 2016

Here is the Nginx Config for Joomla:

upstream examplecombackend {
        server unix:/var/run/php-fcgi-examplecom.sock;
}

server {
        listen 80;
        server_name example.com;
        server_name_in_redirect off;

    	access_log /var/www/vhosts/example.com/access.log;
		error_log /var/www/vhosts/example.com/error.log warn;

        root /var/www/vhosts/example.com/htdocs;
        index index.php index.html index.htm default.html default.htm;
		
        # Support Clean (aka Search Engine Friendly) URLs
        location / {
                try_files $uri $uri/ /index.php?$args;
        }

        # 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 ~ \.php$ {
            fastcgi_pass  examplecombackend;
            fastcgi_index index.php;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include /etc/nginx/fastcgi.conf;
        }

        # caching of files 
        location ~* \.(ico|pdf|flv)$ {
                expires 1y;
        }

        location ~* \.(js|css|png|jpg|jpeg|gif|swf|xml|txt)$ {
                expires 14d;
        }

}