Installing a custom Nginx on Dreamhost
If you don't want to use the nginx server on Dreamhost VPS but want to run your own, this guide is for you. We can build a custom version of it and then use the proxy feature on Dreamhost to direct traffic to it. This whole process only takes about 10 minutes. This guide may work on other hosts where you do not have root privileges.
Load pre requisites and build Nginx
Install this library first. Before you can build it.
mkdir nginx
cd nginx
mkdir src
cd src
wget https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz/download pcre-8.45.tar.gz
tar -zxvf pcre-8.45.tar.gz
wget http://nginx.org/download/nginx-1.26.3.tar.gz
tar -zxvf nginx-1.26.3.tar.gz
./configure --prefix=$HOME/nginx --with-pcre=../pcre-8.45
make
make install
Configure and run the server
Now you can navigate to your config file and get it all set up. You will want to run it on a specific port and then proxy traffic to it by using the proxy feature on Dreamhost VSP. Run as non daemon for testing at first.
./nginx/sbin/nginx -g "daemon off;"
To restart the server after making changes, you can use this.
./nginx/sbin/nginx -s reload
Auto start
To have it automatically start on reboot, you can add a similar line to your crontab.
crontab -e
@reboot /home/username/nginx/sbin/nginx
That is it, enjoy!