From 25625fa70615efad727d00438069af13f9c0a293 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Tue, 24 Feb 2015 15:48:16 +0000 Subject: [PATCH] Created Add a Virtual Host (markdown) --- Add-a-Virtual-Host.md | 84 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 Add-a-Virtual-Host.md diff --git a/Add-a-Virtual-Host.md b/Add-a-Virtual-Host.md new file mode 100644 index 0000000..fc4fa65 --- /dev/null +++ b/Add-a-Virtual-Host.md @@ -0,0 +1,84 @@ +In order to access the PHPCI web interface, you need to set up a virtual host in your web server. + +Below are a few examples of how to do this for various different web servers. + +## Nginx Example: + +``` +server { + ... standard virtual host ... + + location / { + try_files $uri @phpci; + } + + location @phpci { + # Pass to FastCGI: + fastcgi_pass unix:/path/to/phpfpm.sock; + fastcgi_index index.php; + fastcgi_buffers 256 4k; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root/index.php; + } +} +``` + +## Apache Example: + +``` + + ... standard virtual host ... + + + RewriteEngine On + RewriteBase / + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule . /index.php [L] + + +``` + +## Other Servers + +### Lighttpd Example (lighttpd >= `1.4.24`): + +This example uses the `$HTTP["host"]` conditional block because `$HTTP["url"]` blocks aren't supported with url rewriting in lighttpd <= `1.4.33` (source: [lighttpd docs for mod_rewrite](http://redmine.lighttpd.net/projects/1/wiki/Docs_ModRewrite)). In lighttpd >= `1.4.34` however, [this has been fixed](http://redmine.lighttpd.net/issues/2526). + +### lighttpd <= `1.4.33` +``` +$HTTP["host"] =~ "^phpci\.example\.com$" { + # Rewrite all requests to non-physical files + url.rewrite-if-not-file = + ( + "^(.*)$" => "index.php/$1" + ) +} +``` + +### lighttpd >= `1.4.34` +``` +$HTTP["url"] =~ "^\/PHPCI/$" { + # Rewrite all requests to non-physical files + url.rewrite-if-not-file = + ( + "^(.*)$" => "index.php/$1" + ) +} +``` + +If you ~~would like~~ are forced to use lighttpd <= `1.4.24`, [you can use mod_magnet and Lua instead] (http://redmine.lighttpd.net/projects/1/wiki/AbsoLUAtion). + +### Built-in PHP Server Example: + +You can use the built-in PHP server `php -S localhost:8080` by adding `public/routing.php`. + +```php +