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.