Setting up Ajenti + Joomla + Nginx, getting 502 and 404 errors

August 30, 2015 1.3k views
PHP Joomla Nginx Control Panels

So I have had a good go at this and can't get any further. I have managed to install Ajenti + Ajenti V, phpMyAdmin and Wordpress via the tutorials.

I am now stuck mirgating over a Joomla install. Files and Database are done and I am getting stuck on the nginx setup. I have consulted and put the relevant parts in Websites / mywebsite / advanced / custom configuration.

server {
        listen 80;
        server_name_in_redirect off;

        access_log /var/log/nginx/localhost.access_log;
        error_log /var/log/nginx/localhost.error_log info;

        root srv/;
        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_index index.php;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include /etc/nginx/fcgi.conf;

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

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


I am getting 502 errors on the /administrator/index.php url and 404 errors on the frontpage.

I am stuck on this and any help would be helpful. Ajenti auto creates the /etc/nginx/conf.d/mywebsite.conf file with the other parts.


1 comment
  • Have you checked the logs to get a better understand? Permissions maybe?

    chown -R nginx:nginx /srv/your_site_directory
Be the first one to answer this question.