Tutorial Simple Bash to build & install latest NGINX + Pagespeed + PHP 7.3 + MySQL

null3d

Member
Oct 9, 2015
40
24
43
As written in the comments in the header of the file:

Put the bash script in a file called vpsrv.sh and execute chmod +x ./vpsrv.sh and then run the file using ./vpsrv.sh

If you have any questions you can reply to this thread. I will not reply to PMs

Bash:
#!/bin/bash
# LEMP setup by vpsrv.com
# chmod +x ./vpsrv.sh
# ./vpsrv.sh
# Please note: This is still a simple setup. You still need to configure your Webserver and your Server properly.
# Also you will need to manually activate php in your /etc/nginx/ config.

sed -i "s|# deb-src|deb-src|" /etc/apt/sources.list
apt update
export DEPS=" \
  build-essential zlib1g-dev libpcre3-dev unzip uuid-dev \
  debhelper po-debconf libexpat-dev libgd-dev libgeoip-dev libhiredis-dev \
  libluajit-5.1-dev libmhash-dev libpam0g-dev libperl-dev libssl-dev libxslt1-dev quilt software-properties-common"
apt install -y $DEPS

# Nginx Pagespeed
ln -s /bin/bash /bin/sudo

# Service & user creation...
useradd --no-create-home nginx
mkdir -p /var/cache/nginx/client_temp
mkdir /etc/nginx/conf.d/
wget https://vpsrv.com/nginx-conf -O /lib/systemd/system/nginx.service
systemctl enable nginx
systemctl start nginx


# Nginx - We will install the latest version at the time of creating this bash: 1.17.1
bash <(curl -f -L -sS https://ngxpagespeed.com/install) \
--nginx-version latest


# Verify installation
[ ! -z "`nginx -V 2>&1 | grep pagespeed`" ] && echo "Nginx with Pagespeed successfully installed!"

# Latest php version + additional extensions
sudo add-apt-repository ppa:ondrej/php
sudo apt update
apt install php7.3 php7.3-gd php7.3-mysql php7.3-xml php7.3-zip php7.3-mcrypt -y

# MySQL installation. Needs work.
apt install mysql-server -y
mysql_secure_installation

It will ask for configuration parameters. Enter the following:

Code:
--prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module

---- Automatically Merged Double Post ----

Thanks for pointing it out in pm @NatureNMoon

this bash is ONLY for ubuntu for now. A version for CentOS and Fedora will follow
 
Last edited:
Top