Multiple php sites and a Python app using NGINX

0

I've been trying to deploy two PHP sites and one Python app to a single server with a single domain separated by url using NGINX, e.g:

devwiki.company.com/        --> Doku Wiki PHP 7.5       - located at /var/www/html/dokuwiki
devwiki.company.com/qa      --> Question2Anwser PHP 7.5 - located at /var/www/html/qa
devwiki.company.com/askbot  --> Python ASKBOT Q&A framework - located at ~/devaskbot

devwiki.company.com is pointing to intranet 10.2.1.144 at 80, my server is a simple ubuntu 18.

I'm not an expert on this deployment subject and therefore I couldn't understand how to put multiple PHP sites running aside. I successfuly accomplished the task to put only Doku Wiki and Python App live, using the following NGINX configurarion:

File located at /etc/nginx/sites-available/devwiki:

server {
    listen 80;
    listen [::]:80;
    server_name devwiki.company.com;

    root /var/www/html/dokuwiki;
    index  index.php index.html index.htm;

    client_max_body_size 100M;

    location / {
      try_files $uri $uri/ @dokuwiki;
    }

    location @dokuwiki {
        rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
        rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
        rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
        rewrite ^/(.*) /doku.php?id=$1&$args last;
    }

    location ~ \.php$ {
         include snippets/fastcgi-php.conf;
         fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
         include fastcgi_params;
    }

    location = /favicon.ico/ { access_log off; log_not_found off; }

    location /static/ {
        alias /home/devwiki/devaskbot/static/;
    }

    location /upfiles/ {
        alias /home/devwiki/devaskbot/askbot/upfiles/;
    }

    location /media/ {
        alias /home/devwiki/devaskbot/media/;
    }

    location /askbot {
        include proxy_params;
        proxy_pass http://unix:/home/devwiki/devaskbot/devaskbot.sock;
        }

However I couldn't figure out how to implement the QA location into the /etc/nginx/sites-available/devwiki file. Could you please point me to a tutorial or give me any clues to understand this php wichcraft?

Any help will be very much appreciated.

Thanks,

Krayher

Posted 2019-07-19T18:16:52.777

Reputation: 1

This ServerFault question may be of interest.

– Anaksunaman – 2019-07-20T04:50:25.093

No answers