4 # This is variation of Install-on-Ubuntu.sh showcasing how to use the
5 # nginx webserver instead of Apache2. We might eventually merge both
6 # files. Right now expect this file to become outdated/unmaintained
9 # This file lacks many comments found in Install-on-Ubuntu.sh, you
10 # should check that file first to get a basic understanding.
13 # hacks for broken vagrant box
14 sudo rm -f /var/lib/dpkg/lock
15 sudo update-locale LANG=en_US.UTF-8
16 export APT_LISTCHANGES_FRONTEND=none
17 export DEBIAN_FRONTEND=noninteractive
19 sudo apt-get update -qq
20 sudo apt-get install -y build-essential cmake g++ libboost-dev libboost-system-dev \
21 libboost-filesystem-dev libexpat1-dev zlib1g-dev libxml2-dev\
22 libbz2-dev libpq-dev libproj-dev \
23 postgresql-server-dev-10 postgresql-10-postgis-2.4 \
24 postgresql-contrib-10 \
25 nginx php-fpm php php-pgsql php-pear php-db \
28 export USERNAME=vagrant
29 export USERHOME=/home/vagrant
33 # Setting up PostgreSQL
34 # ---------------------
36 # Tune the postgresql configuration, see same section in Install-on-Ubuntu.sh
38 sudo systemctl restart postgresql
40 sudo -u postgres createuser -s $USERNAME
41 sudo -u postgres createuser www-data
44 # Setting up the Nginx Webserver
45 # -------------------------------
47 # You need to configure php-fpm to listen on a Unix socket. Then create Nginx
48 # configuration to forward localhost:80 requests to that socket.
52 sudo tee /etc/php/7.2/fpm/pool.d/www.conf << EOF_PHP_FPM_CONF
54 ; Comment out the tcp listener and add the unix socket
55 ;listen = 127.0.0.1:9000
56 listen = /var/run/php7.2-fpm.sock
58 ; Ensure that the daemon runs as the correct user
59 listen.owner = www-data
60 listen.group = www-data
63 ; Unix user of FPM processes
67 ; Choose process manager type (static, dynamic, ondemand)
75 sudo tee /etc/nginx/sites-available/default << EOF_NGINX_CONF
77 listen 80 default_server;
78 listen [::]:80 default_server;
80 root $USERHOME/build/website;
81 index search.php index.html;
83 try_files \$uri \$uri/ @php;
87 fastcgi_param SCRIPT_FILENAME "\$document_root\$uri.php";
88 fastcgi_param PATH_TRANSLATED "\$document_root\$uri.php";
89 fastcgi_param QUERY_STRING \$args;
90 fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
91 fastcgi_index index.php;
92 include fastcgi_params;
95 location ~ [^/]\.php(/|$) {
96 fastcgi_split_path_info ^(.+?\.php)(/.*)$;
97 if (!-f \$document_root\$fastcgi_script_name) {
100 fastcgi_pass unix:/var/run/php7.2-fpm.sock;
101 fastcgi_index search.php;
102 include fastcgi.conf;
108 sudo sed -i 's:#.*::' /etc/nginx/sites-available/default
112 # Enable the configuration and restart Nginx
115 sudo systemctl stop apache2 # just in case it's installed as well
116 sudo systemctl restart php7.2-fpm nginx
118 # From here continue in the 'Installing Nominatim' section in
119 # Install-on-Ubuntu.sh