+# Activate the services:
+
+if [ "x$NOSYSTEMD" != "xyes" ]; then #DOCS:
+ sudo systemctl daemon-reload
+ sudo systemctl enable nominatim.socket
+ sudo systemctl start nominatim.socket
+ sudo systemctl enable nominatim.service
+fi #DOCS:
+
+
+# Setting up a webserver
+# ======================
+#
+# The webserver is only needed as a proxy between the public interface
+# and the gunicorn service.
+#
+# The frontend will need configuration information from the project
+# directory, which will be populated later
+# [during the import process](../admin/Import.md#creating-the-project-directory)
+# Already create the project directory itself now:
+
+
+ mkdir $USERHOME/nominatim-project
+
+
+# Option 1: Using Apache
+# ----------------------
+#
+if [ "x$2" == "xinstall-apache" ]; then #DOCS:
+# First install apache itself and enable the proxy module:
+
+ sudo apt-get install -y apache2
+ sudo a2enmod proxy_http
+
+# To set up proxying for Apache add the following configuration:
+
+#DOCS:```sh
+sudo tee /etc/apache2/conf-available/nominatim.conf << EOFAPACHECONF
+ProxyPass /nominatim "unix:/run/nominatim.sock|http://localhost/"
+EOFAPACHECONF
+#DOCS:```
+
+#
+# Then enable the configuration and restart apache
+#
+
+ sudo a2enconf nominatim
+if [ "x$NOSYSTEMD" == "xyes" ]; then #DOCS:
+ sudo apache2ctl start #DOCS:
+else #DOCS:
+ sudo systemctl restart apache2
+fi #DOCS:
+
+# The Nominatim API is now available at `http://localhost/nominatim/`.
+
+fi #DOCS:
+
+#
+# Option 2: Using nginx
+# ---------------------
+#
+if [ "x$2" == "xinstall-nginx" ]; then #DOCS:
+
+# First install nginx itself:
+
+ sudo apt-get install -y nginx
+
+# Then create a Nginx configuration to forward http requests to that socket.
+
+#DOCS:```sh
+sudo tee /etc/nginx/sites-available/default << EOF_NGINX_CONF
+server {
+ listen 80 default_server;
+ listen [::]:80 default_server;
+
+ root $USERHOME/nominatim-project/website;
+ index /search;
+
+ location /nominatim/ {
+ proxy_set_header Host \$http_host;
+ proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto \$scheme;
+ proxy_redirect off;
+ proxy_pass http://unix:/run/nominatim.sock:/;
+ }
+}
+EOF_NGINX_CONF
+#DOCS:```
+
+# Enable the configuration and restart Nginx
+#
+
+if [ "x$NOSYSTEMD" == "xyes" ]; then #DOCS:
+ sudo /usr/sbin/nginx & #DOCS:
+else #DOCS:
+ sudo systemctl restart nginx
+fi #DOCS:
+
+# The Nominatim API is now available at `http://localhost/`.
+
+