我是一个nginx noob,我正在寻找一些帮助(我的nginxconfiguration如下)。 我试图把nginx放在当前使用Apache的PHP应用程序前面。
我的“/”位置正常工作。 Nginx正在为dynamic内容提供静态文件和代理到apache。
我现在试图使“UserDir”function正常工作。 我需要http://example.com/~mmattax/使用/ home / mmattax / public_html作为文档根目录,并将代理用于dynamic内容的apache。 我的下面的尝试似乎代理一切到Apache; nginx似乎没有使用正确的文档根目录。
我也正在寻找下面的configuration任何提示。 谢谢。
location ~ ^/~(.+?)(/.*)?$ { root /home/$1/public_html; index index.php; autoindex on; try_files $uri $uri/ @proxy; } location / { root /home/myapp/www; index index.php; try_files $uri $uri/ @proxy; } location @proxy { proxy_pass http://127.0.0.1:8080; proxy_redirect off; } location ~ \.php$ { proxy_pass http://127.0.0.1:8080; proxy_redirect off; }
我在nginx维基上发现了这个
location ~ ^/~(.+?)(/.*)?$ { alias /home/$1/public_html$2; index index.html index.htm; autoindex on; }