Hi,
I would like to serve two applications with uwsgi:
- application A under /appA (and all subfolders)
- application B under / (and all subfolders except /appA)
My setup:
I use Debian 8 with uwsgi 2.0.7-debian
arch: x86_64
uwsgi is at the front, serving app and static files
My config file is:
[uwsgi]
master=true
plugin=http,0:php,router_uwsgi,router_rewrite
http-socket = 0.0.0.0:80
# maximum processes num.
processes = 10
# minimum processes num.
cheaper = 1
chdir = /www
# this two routes does not work (appA is executed with this URL which gives
404)
# I have tried setscriptfile as well
route = ^/app-B/index.php setfile:/www/app-B/app-B/index.php
route = ^/app-B/ setfile:/www/app-B/app-B/index.php
# this to routes are just to make nice urls:
# * / -> serves /index.php
# * /dir -> serves /dir/index.php
route-if = isdir:/www/app-A${PATH_INFO} rewrite:${PATH_INFO}/index.php
route-if-not = isfile:/www/app-A${PATH_INFO} rewrite:/index.php
php-set = open_basedir=/www/app-A/:/www/tmp/:/www/app-B
php-set = include_path=/www/app-A/:/www/app-B
php-set = date.timezone=UTC
php-set = upload_max_filesize = 100M
php-set = post_max_size = 100M
php-set = upload_tmp_dir=/www/tmp/
php-set = display_errors=On
php-set = display_startup_errors=On
php-set = error_reporting=E_ALL&~E_NOTICE
php-set = error_log = /tmp/php.error.log
php-docroot = /www/app-A/
#php-docroot = /www/app-B/ -- this is probably not allowed, break
stuff if enabled
php-index = index.php
php-allowed-ext = .php
php-allowed-ext = .inc
# serving static files with / (app-A) and /app-B (app-B) works perfectly
# the problem is only with php files
check-static=/www/app-A/
check-static=/www/app-B/
static-skip-ext = .php
static-skip-ext = .inc
# end of the config
Do you have any ideas how I can set up routing (or other options) to serve
/app-B from a different directory than app-A?
---- showconfig
# uwsgi --show-config uwsgi.ini
[uWSGI] getting INI configuration from uwsgi.ini
[uwsgi-static] added check for /www/app-A/
[uwsgi-static] added check for /www/app-B/
;uWSGI instance configuration
[uwsgi]
show-config = true
master = true
plugin = http,0:php,router_uwsgi,router_rewrite
http-socket = 0.0.0.0:80
processes = 10
cheaper = 1
chdir = /www
route = ^/appB/index.php setfile:/www/app-B/app-B/index.php
route = ^/appB/ setfile:/www/app-B/app-B/index.php
route-if = isdir:/www/app-A${PATH_INFO} rewrite:${PATH_INFO}/index.php
route-if-not = isfile:/www/app-A${PATH_INFO} rewrite:/index.php
php-set = open_basedir=/www/app-A/:/www/tmp/:/www/app-B
php-set = include_path=/www/app-A/:/www/app-B
php-set = date.timezone=UTC
php-set = upload_max_filesize = 100M
php-set = post_max_size = 100M
php-set = upload_tmp_dir=/www/tmp/
php-set = display_errors=On
php-set = display_startup_errors=On
php-set = error_reporting=E_ALL&~E_NOTICE
php-set = error_log = /tmp/php.error.log
php-docroot = /www/app-A/
php-index = index.php
php-allowed-ext = .php
php-allowed-ext = .inc
check-static = /www/app-A/
check-static = /www/app-B/
static-skip-ext = .php
static-skip-ext = .inc
;end of configuration
*** Starting uWSGI 2.0.7-debian (64bit) on [Sun Nov 8 19:52:23 2015] ***
compiled with version: 4.9.1 on 25 October 2014 19:17:54
os: Linux-3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u5 (2015-10-09)
nodename: da0e8addb646
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /
detected binary path: /usr/bin/uwsgi-core
*** dumping internal routing table ***
[rule: 0] subject: path_info regexp: ^/app-B/index.php action:
setfile:/www/app-B/app-B/index.php
[rule: 1] subject: path_info regexp: ^/app-B/ action:
setfile:/www/app-B/app-B/index.php
[rule: 2] subject: /www/app-A${PATH_INFO} func: isdir action:
rewrite:${PATH_INFO}/index.php
[rule: 3] subject: /www/app-A${PATH_INFO} func: !isfile action:
rewrite:/index.php
*** end of the internal routing table ***
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
your processes number limit is 1048576
your memory page size is 4096 bytes
detected max file descriptor number: 1048576
building mime-types dictionary from file /etc/mime.types...547 entry found
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 0.0.0.0:80 fd 3
uwsgi socket 1 bound to TCP address 0.0.0.0:443 fd 4
PHP 5.6.2-1 initialized
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 1111616 bytes (1085 KB) for 10 cores
*** Operational MODE: preforking ***
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 14)
spawned uWSGI worker 1 (pid: 16, cores: 1)
----
Cheers,
Tom
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi