Difference between revisions of "KB00005:Web Server Configuration"
(→Individual Errors) |
|||
(8 intermediate revisions by the same user not shown) | |||
Line 7: | Line 7: | ||
* [https://httpd.apache.org/docs/2.2/en/mod/core.html#acceptpathinfo AcceptPathInfo] set to ON | * [https://httpd.apache.org/docs/2.2/en/mod/core.html#acceptpathinfo AcceptPathInfo] set to ON | ||
* [https://httpd.apache.org/docs/2.2/en/mod/mod_rewrite.html mod_rewrite] enabled | * [https://httpd.apache.org/docs/2.2/en/mod/mod_rewrite.html mod_rewrite] enabled | ||
− | * Must be able to parse the [https://httpd.apache.org/docs/2.4/howto/htaccess.html .htaccess file]. Ensure that [https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride AllowOverride] is at least set to '''FileInfo''' and '''Options'''. | + | * Must be able to parse the [https://httpd.apache.org/docs/2.4/howto/htaccess.html .htaccess file]. Ensure that [https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride AllowOverride] is at least set to '''Indexes''', '''FileInfo''' and '''Options''', however, if you encounter problems, use '''All'. |
+ | On Debian-Based systems, you can usually activate mod_rewrite using: | ||
+ | <pre> | ||
+ | a2enmod rewrite | ||
+ | </pre> | ||
+ | |||
+ | Example config for <code>demo.partkeepr.org</code> running on Apache 2.4 on Debian Jessie: | ||
+ | |||
+ | <pre> | ||
+ | <VirtualHost *:80> | ||
+ | ServerName demo.partkeepr.org | ||
+ | |||
+ | DocumentRoot /home/demo.partkeepr.org/PartKeepr/web/ | ||
+ | AcceptPathInfo on | ||
+ | |||
+ | ErrorDocument 403 "<h1>Demo Site update in progress. Check back in a few minutes.</h1>" | ||
+ | |||
+ | <Directory /home/demo.partkeepr.org/PartKeepr/web/> | ||
+ | Require all granted | ||
+ | AllowOverride All | ||
+ | </Directory> | ||
+ | |||
+ | ## Logging | ||
+ | ErrorLog "/var/log/apache2/demo.partkeepr.org_error.log" | ||
+ | ServerSignature Off | ||
+ | CustomLog "/var/log/apache2/demo.partkeepr.org_access.log" combined | ||
+ | </VirtualHost> | ||
+ | |||
+ | </pre> | ||
= nginx = | = nginx = | ||
− | You need to configure nginx so that it passes the path_info to PHP, that is, everything which is added after a PHP script (like setup.php/test). Also make sure you set your root directory to your PartKeepr '''web/''' directory. | + | {{note|Note that this configuration might be outdated. We recommend to use Apache2 as it is easier to setup. If you have to use nginx, please check the PartKeepr issue tracker for [https://goo.gl/L93Hp6 Nginx Issues] }} |
+ | |||
+ | You need to configure nginx so that it passes the path_info to PHP, that is, everything which is added after a PHP script (like setup.php/test). Also make sure you set your root directory to your PartKeepr '''web/''' directory. If you have set your root directory to '''web/''', you need to open '''setup/index.html''' instead of '''web/setup/index.html'''. | ||
<pre> | <pre> | ||
− | # | + | server { |
− | + | # Listening port and host address | |
+ | listen 80; | ||
+ | server_name partkeepr.example.com; | ||
+ | |||
+ | # Default index pages | ||
+ | index app.php index.html | ||
+ | |||
+ | # Default character set | ||
+ | charset utf-8; | ||
+ | |||
+ | # Turn off access.log writes | ||
+ | access_log off; | ||
+ | log_not_found off; | ||
+ | |||
+ | # Send file is an optimization, but does not work | ||
+ | # across unix sockets which I use for php fpm so is best | ||
+ | # used for local static content onlya | ||
+ | sendfile off; | ||
+ | |||
+ | # Root for / project | ||
+ | root /var/www/partkeepr/web/; | ||
− | + | # Setup rewrite helper | |
− | + | rewrite ^/setup/webserver-test$ /setup/tests/webservercheck.json; | |
− | |||
+ | # Handle main / location to symfony app.php controller | ||
location / { | location / { | ||
− | + | try_files $uri $uri/ /app.php?$query_string; | |
− | try_files $uri /app.php$ | ||
} | } | ||
− | # | + | # Handle /setup location to symfony setup.php controller |
− | + | location /setup { | |
+ | try_files $uri $uri/ /setup.php?$query_string; | ||
+ | } | ||
− | location ~ ^ | + | # Handle all locations *.php files via PHP-FPM unix socket |
− | fastcgi_pass unix:/var/run/php5-fpm.sock; | + | location ~ \.php$ { |
− | + | fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
+ | #fastcgi_pass unix:/var/run/php5-fpm.sock; | ||
+ | fastcgi_pass unix://var/run/php/php7.0-fpm.sock; | ||
+ | fastcgi_index index.php; | ||
include fastcgi_params; | include fastcgi_params; | ||
− | + | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
− | + | fastcgi_intercept_errors off; | |
− | + | fastcgi_buffer_size 16k; | |
− | + | fastcgi_buffers 4 16k; | |
− | |||
− | |||
− | |||
− | fastcgi_param | ||
− | |||
} | } | ||
− | # | + | |
− | location ~ | + | # Deny .ht* access |
− | + | location ~ /\.ht { | |
− | + | deny all; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
+ | } | ||
+ | |||
</pre> | </pre> | ||
+ | |||
+ | = Individual Errors = | ||
+ | |||
+ | == Error 1: Tried to send a POST request to setup/webserverTest and it did not succeed. == | ||
+ | |||
+ | PartKeepr sends a HTTP POST request to <code>setup/webserverTest</code>. This request is served by <code>web/app.php</code>. | ||
+ | |||
+ | == Error 2: Tried to retrieve setup/webserver-test and it did not succeed. == | ||
+ | |||
+ | PartKeepr sends a HTTP POST request to <code>setup/webserver-test</code>. Your webserver must be configured to serve the file <code>setup/tests/webservercheck.json</code>. | ||
+ | |||
[[Category:Knowledge Base]] | [[Category:Knowledge Base]] |
Latest revision as of 12:38, 7 July 2018
PartKeepr requires special configuration in some cases.
Contents
Apache
Apache requires the following settings:
- AcceptPathInfo set to ON
- mod_rewrite enabled
- Must be able to parse the .htaccess file. Ensure that AllowOverride is at least set to Indexes, FileInfo and Options, however, if you encounter problems, use All'.
On Debian-Based systems, you can usually activate mod_rewrite using:
a2enmod rewrite
Example config for demo.partkeepr.org
running on Apache 2.4 on Debian Jessie:
<VirtualHost *:80> ServerName demo.partkeepr.org DocumentRoot /home/demo.partkeepr.org/PartKeepr/web/ AcceptPathInfo on ErrorDocument 403 "<h1>Demo Site update in progress. Check back in a few minutes.</h1>" <Directory /home/demo.partkeepr.org/PartKeepr/web/> Require all granted AllowOverride All </Directory> ## Logging ErrorLog "/var/log/apache2/demo.partkeepr.org_error.log" ServerSignature Off CustomLog "/var/log/apache2/demo.partkeepr.org_access.log" combined </VirtualHost>
nginx
You need to configure nginx so that it passes the path_info to PHP, that is, everything which is added after a PHP script (like setup.php/test). Also make sure you set your root directory to your PartKeepr web/ directory. If you have set your root directory to web/, you need to open setup/index.html instead of web/setup/index.html.
server { # Listening port and host address listen 80; server_name partkeepr.example.com; # Default index pages index app.php index.html # Default character set charset utf-8; # Turn off access.log writes access_log off; log_not_found off; # Send file is an optimization, but does not work # across unix sockets which I use for php fpm so is best # used for local static content onlya sendfile off; # Root for / project root /var/www/partkeepr/web/; # Setup rewrite helper rewrite ^/setup/webserver-test$ /setup/tests/webservercheck.json; # Handle main / location to symfony app.php controller location / { try_files $uri $uri/ /app.php?$query_string; } # Handle /setup location to symfony setup.php controller location /setup { try_files $uri $uri/ /setup.php?$query_string; } # Handle all locations *.php files via PHP-FPM unix socket location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; #fastcgi_pass unix:/var/run/php5-fpm.sock; fastcgi_pass unix://var/run/php/php7.0-fpm.sock; fastcgi_index index.php; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_intercept_errors off; fastcgi_buffer_size 16k; fastcgi_buffers 4 16k; } # Deny .ht* access location ~ /\.ht { deny all; } }
Individual Errors
Error 1: Tried to send a POST request to setup/webserverTest and it did not succeed.
PartKeepr sends a HTTP POST request to setup/webserverTest
. This request is served by web/app.php
.
Error 2: Tried to retrieve setup/webserver-test and it did not succeed.
PartKeepr sends a HTTP POST request to setup/webserver-test
. Your webserver must be configured to serve the file setup/tests/webservercheck.json
.