X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/3aa6e6a365dbe8eef3012c4ab47357ffec3ea5b2..4be6970bd437db93e90bc46c2b5a0ddf14be1e5b:/docs/admin/Deployment.md diff --git a/docs/admin/Deployment.md b/docs/admin/Deployment.md index 9ef7f489..8b635546 100644 --- a/docs/admin/Deployment.md +++ b/docs/admin/Deployment.md @@ -1,7 +1,7 @@ # Deploying Nominatim The Nominatim API is implemented as a PHP application. The `website/` directory -in the build directory contains the configured website. You can serve this +in the project directory contains the configured website. You can serve this in a production environment with any web server that is capable to run PHP scripts. @@ -13,10 +13,11 @@ to run a web service. Please refer to the documentation of for background information on configuring the services. !!! Note - Throughout this page, we assume that your Nominatim build directory is - located in `/srv/nominatim/build` and the source code in - `/srv/nominatim/Nominatim`. If you have put it somewhere else, you - need to adjust the commands and configuration accordingly. + Throughout this page, we assume that your Nominatim project directory is + located in `/srv/nominatim-project` and that you have installed Nominatim + using the default installation prefix `/usr/local`. If you have put it + somewhere else, you need to adjust the commands and configuration + accordingly. We further assume that your web server runs as user `www-data`. Older versions of CentOS may still use the user name `apache`. You also need @@ -29,7 +30,7 @@ web server user. You can check that the permissions are correct by accessing on of the php files as the web server user: ``` sh -sudo -u www-data head -n 1 /srv/nominatim/build/website/search.php +sudo -u www-data head -n 1 /srv/nominatim-project/website/search.php ``` If this shows a permission error, then you need to adapt the permissions of @@ -40,11 +41,11 @@ web server access. At a minimum the following SELinux labelling should be done for Nominatim: ``` sh -sudo semanage fcontext -a -t httpd_sys_content_t "/srv/nominatim/Nominatim/(website|lib|settings)(/.*)?" -sudo semanage fcontext -a -t httpd_sys_content_t "/srv/nominatim/build/(website|settings)(/.*)?" -sudo semanage fcontext -a -t lib_t "/srv/nominatim/build/module/nominatim.so" -sudo restorecon -R -v /srv/nominatim/Nominatim -sudo restorecon -R -v /srv/nominatim/build +sudo semanage fcontext -a -t httpd_sys_content_t "/usr/local/nominatim/lib/lib-php(/.*)?" +sudo semanage fcontext -a -t httpd_sys_content_t "/srv/nominatim-project/website(/.*)?" +sudo semanage fcontext -a -t lib_t "/srv/nominatim-project/module/nominatim.so" +sudo restorecon -R -v /usr/local/lib/nominatim +sudo restorecon -R -v /srv/nominatim-project ``` ## Nominatim with Apache @@ -65,13 +66,13 @@ Make sure your Apache configuration contains the required permissions for the directory and create an alias: ``` apache - + Options FollowSymLinks MultiViews AddType text/html .php DirectoryIndex search.php Require all granted -Alias /nominatim /srv/nominatim/build/website +Alias /nominatim /srv/nominatim-project/website ``` After making changes in the apache config you need to restart apache. @@ -81,7 +82,7 @@ The website should now be available on `http://localhost/nominatim`. ### Installing the required packages -Nginx has no built-in PHP interpreter. You need to use php-fpm as a deamon for +Nginx has no built-in PHP interpreter. You need to use php-fpm as a daemon for serving PHP cgi. On Ubuntu/Debian install nginx and php-fpm with: @@ -98,7 +99,7 @@ Unix socket instead, change the pool configuration ``` ini ; Replace the tcp listener and add the unix socket -listen = /var/run/php-fpm.sock +listen = /var/run/php-fpm-nominatim.sock ; Ensure that the daemon runs as the correct user listen.owner = www-data @@ -110,7 +111,7 @@ Tell nginx that php files are special and to fastcgi_pass to the php-fpm unix socket by adding the location definition to the default configuration. ``` nginx -root /srv/nominatim/build/website; +root /srv/nominatim-project/website; index search.php; location / { try_files $uri $uri/ @php; @@ -120,7 +121,7 @@ location @php { fastcgi_param SCRIPT_FILENAME "$document_root$uri.php"; fastcgi_param PATH_TRANSLATED "$document_root$uri.php"; fastcgi_param QUERY_STRING $args; - fastcgi_pass unix:/var/run/php-fpm.sock; + fastcgi_pass unix:/var/run/php-fpm-nominatim.sock; fastcgi_index index.php; include fastcgi_params; } @@ -130,7 +131,7 @@ location ~ [^/]\.php(/|$) { if (!-f $document_root$fastcgi_script_name) { return 404; } - fastcgi_pass unix:/var/run/php-fpm.sock; + fastcgi_pass unix:/var/run/php-fpm-nominatim.sock; fastcgi_index search.php; include fastcgi.conf; } @@ -139,3 +140,9 @@ location ~ [^/]\.php(/|$) { Restart the nginx and php-fpm services and the website should now be available at `http://localhost/`. +## Nominatim with other webservers + +Users have created instructions for other webservers: + +* [Caddy](https://github.com/osm-search/Nominatim/discussions/2580) +