Viewing a single comment thread. View all comments

WindTalk wrote (edited )

ok, so I did a complete setup of PHP 7.2, PostgreSQL 10.1, nginx/1.10.3 and managed to get Postmill runing via nginx.

  1. my root folder is /home/myuser/PostmillSite0/Postmill (I did a git checkout from /home/myuser/PostmillSite0 folder)
  2. Everything is working fine with the bin/console server:run using my account myuser
  3. Then i went with the bone-stock version of nginx that Ubuntu 16.04 currently provides.
  4. Based on the information you provided, you and I are both running the same version of PHP 7.2 - HOWEVER

I notice something, you are using Ubuntu 17.10? To run a server in public, I think most would go with 16.04 - as it's LTS and there is more documentation out there on it. (I saw your "" vs mine "")

I suspect that puts you on a different, newer version, of nginx/1.10.3 - and maybe some alternate configs?

Here is the config I used that was a non-default site. nginx/1.10.3 is providing a simple static file for my default, using what Ubuntu 16.04 setup. - will show that default site.

Now, to wire up PHP and Postmill, I added a second site (same IP Address, same port):


server {
    root /home/myuser/PostmillSite0/Postmill/public;

    location / {
        # try to serve file directly, fallback to index.php
        try_files $uri /index.php$is_args$args;

    location ~ ^/index\.php(/|$) {
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_split_path_info ^(.+\.php)(/.*)$;
        include fastcgi_params;

        # optionally set the value of the environment variables used in the application
        # fastcgi_param APP_ENV prod;
        # fastcgi_param APP_SECRET <app-secret-id>;
        # fastcgi_param DATABASE_URL "mysql://db_user:db_pass@host:3306/db_name";

        # Postmill
        fastcgi_param APP_ENV 'prod';
        fastcgi_param APP_SECRET 'mysecret';
        fastcgi_param SITE_NAME '';
        fastcgi_param DATABASE_URL 'pgsql://postmill:mydatapassword@';
        fastcgi_param MAILER_URL 'smtp://localhost:25?encryption=&auth_mode=';
        fastcgi_param NO_REPLY_ADDRESS '';

        # When you are using symlinks to link the document root to the
        # current version of your application, you should pass the real
        # application path instead of the path to the symlink to PHP
        # FPM.
        # Otherwise, PHP's OPcache may not properly detect changes to
        # your PHP files (see
        # for more information).
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        fastcgi_param DOCUMENT_ROOT $realpath_root;
        # Prevents URIs that include the front controller. This will 404:
        # http://domain.tld/index.php/some-path
        # Remove the internal directive to allow URIs like this

    # return 404 for all other php files not matching the front controller
    # this prevents access to other php files you don't want to be accessible.
    location ~ \.php$ {
        return 404;

    error_log /var/log/nginx/project_error.log;
    access_log /var/log/nginx/project_access.log;

And, it's working fine off of - and responding correctly. I did waste 30 minutes figuring out that the proper PHP 7.2 path for /var/run/php/php7.2-fpm.sock - but once I solved that issue, Postmill started working file via nginx.

My Ubuntu 16.04 server has only 1GB of RAM, so I'm running Postmill on Nginx off of less than what you are attempting.

cat /proc/meminfo

MemTotal:        1048576 kB
MemFree:          501372 kB
Cached:           126480 kB
Buffers:               0 kB
Active:            84096 kB
Inactive:         131424 kB
Active(anon):      34932 kB
Inactive(anon):    54108 kB
Active(file):      49164 kB
Inactive(file):    77316 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       1048576 kB
SwapFree:        1034996 kB
Dirty:             42252 kB
Writeback:             0 kB
AnonPages:         89040 kB
Shmem:            316680 kB
Slab:              14984 kB
SReclaimable:       3744 kB
SUnreclaim:        11240 kB