1

First of all, my Nginx configuration

    server {
      listen 1443 ssl http2;
      root /usr/share/webapps/postfixadmin/public/;
      index index.php;
      charset utf-8;
     
      server_name postfixadmin;
      
      ssl_certificate /etc/ssl/example.com/example.com.crt;
      ssl_certificate_key /etc/ssl/example.com/example.com.key;

      access_log /var/log/nginx/postfixadmin-access.log;
      error_log /var/log/nginx/postfixadmin-error.log;
     

      location / {
    try_files $uri $uri/ /index.php;
      }

     
      location ~* \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include fastcgi_params;
        fastcgi_pass unix:/run/postfixadmin/postfixadmin.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
      }
    }

It all works nice and dandy, but I would like to be able to access the Postfixadmin via https://example.com/admin.

I can't figure out how to do it, I've tried aliases, putting root in the location, nested locations. I keep hitting 404s and 403s.

I know this can easily be achieved with Apache by using an alias, but it doesn't seem to work with Nginx, and since I have a few web apps already working with Nginx I'd like to keep everything in there, I am stubborn like that.

I will most likely give up and move everything to Apache.

I've tried a few solutions, as I was not the only one asking about this and I don't just create a post without searching.

My question is What would be the best approach to making Postfixadmin work as mentioned above?

Thank you.

Ai N.
  • 21
  • 2
  • Can you try to do [the same](https://stackoverflow.com/a/62362487/7121513) for postfixadmin? You may need to change the `include fastcgi.conf;` to `include fastcgi_params;` depending on distro/package you are using. If succeed, please provide some feedback (well, if you don't, provide feedback too :). – Ivan Shatsky May 15 '22 at 12:32
  • @IvanShatsky the include was already set to fastcgi_params; I'm running it on arch. I did spot a few things that might work, I will return with feedback and edit this comment. – Ai N. May 15 '22 at 14:58
  • @IvanShatsky I've decided to go the proxy way using proxy_pass. – Ai N. May 17 '22 at 04:58
  • One more question if you won't mind, you didn't try that solution or you tried it and it didn't work for postfixadmin? – Ivan Shatsky May 17 '22 at 07:18

0 Answers0