-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
poitch edited this page Sep 14, 2010
·
6 revisions
sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart
<VirtualHost *:80>
DocumentRoot /path_to_webapp/docroot/
ServerName vhost.domain.com
CustomLog /var/log/apache2/access.log combined
ErrorLog /var/log/apache2/error.log
</VirtualHost>
For the nginx web server you need to use FastCGI PHP and basically route all requests to dispath.php in the docroot directory of the application.
server {
listen 80;
server_name some.hostname.com;
root /path_to_webapp/app/docroot;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
location / {
gzip_static on;
# serve static files directly
if (-f $request_filename) {
expires 5d;
break;
}
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
rewrite ^(.*)$ /dispatch.php?path=$1 last;
index index.php index.html index.htm;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /path_to_webapp/app/docroot/dispatch.php;
fastcgi_param PATH_INFO $uri;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}