0

This is my third attempt at posting this question now after incorrectly posting to both super user and Stack Overflow. Hopefully this is now the right place!

I have taken over managing the company's web hosting, which is an AWS server running Amazons own version of Linux and Nginx.

I don't have much experience of Nginx, but I need to create a subdomain running a development version of the site. There is already an existing "Staging" virtual host, however it is linked to the main sites database making useless.

I have copied the staging conf file from /etc/nginx/conf.d/staging.conf to /etc/nginx/conf.d/dev.conf and changed all instances of "staging" within the file to "dev".

This is what the file looks like:

upstream php-dev-backend {
    server unix:/tmp/php-fpm-dev.sock weight=1;
}

server {
    server_name dev.groundlevel.co.uk;
    listen 80;

    root /var/www/vhosts/dev.groundlevel.co.uk/web-root;

    index index.html index.htm index.php;
    access_log /var/log/nginx/dev.groundlevel.co.uk_access_log;
    error_log /var/log/nginx/dev.groundlevel.co.uk_error_log;
    location @handler {
        rewrite / /index.php;
    }
location / {
    index index.php index.html;
        try_files $uri $uri/ @handler;
        expires 30d;
    }

include magento_security;

include fastcgi_params;
location ~ \.php$ {
        if (!-e $request_filename) {
             rewrite / /index.php last;
        }
        include fastcgi_params;
        fastcgi_pass php-dev-backend;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    }
}

However this is leading to a 502 error as /tmp/php-fpm-dev.sock doesn't exist and I have no Idea how to create it. Or if I can change the conf file to not need the socket.

Could someone please explain how to get the socket running? Thanks!

2
  • Do you need to run a separate php-fpm for the dev site? Why can't they share? Just use the same socket
    – ptman
    Sep 15, 2017 at 15:06
  • I have just had that suggested to me from the question I posted on stackoverflow by mistake which has worked out fine. I have just been trying to follow the same as what the company managing the hosting previously had done, with a separate socket for the live and staging sites
    – Edward144
    Sep 15, 2017 at 15:10

2 Answers 2

0

If you don't have more than one php-fpm running, point your virtualhosts to the same php-fpm socket.

0

Check if PHP-FPM is already running with service php-fpm status if not start service with service php-fpm start (and check logfile for possible errors). To enable PHP-FPM on startup run chkconfig php-fpm on

1
  • It is already running and I have tried restarting it to see if that would help. There are no errors in the php-fpm error log other than a series of - NOTICE: [pool groundlevel] child ##### exited with code 0 after ##### seconds from start
    – Edward144
    Sep 15, 2017 at 14:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .