@andrewcrayden
You can definitely setup a Droplet and configure Apache/NGINX/Caddy/[insert-web-server] as your web server and run PHP, NodeJS, Python, Java or [insert-programming-language] as well. The only thing you’d need to keep in mind is the requirements for each.
If you’re going to run multiple environments, make sure you have the resources to handle them. I’d recommend at least a 2GB Droplet if this is the plan, especially if you plan on also using a database server (such as MySQL, MariaDB, Percona, Postgres etc).
The vast majority can be setup from the CLI using repository packages and either yum
or apt-get
(CentOS will use yum
while Debian & Ubuntu use apt-get
).
–
For example, to install NGINX + PHP-FPM on Debian/Ubuntu with support for MySQL (or any fork of MySQL, such as MariaDB / Percona), you’d issue the following commands from the CLI:
NOTE: Debian does not pre-install sudo
, the package must be installed first. This isn’t required for Ubuntu. So if you choose Debian, you’d issue the first command to install the sudo
package first and then proceed with the remaining commands. If you choose Ubuntu, simply omit the first command.
Installs sudo
:
apt-get install -y sudo
Installs nginx
:
sudo apt-get install -y nginx
Installs php-fpm
:
sudo apt-get install -y php5-cli php5-fpm php5-dev php5-common php5-mysqlnd
Installs mariadb
(a fork of MySQL):
sudo apt-get install mariadb-server
The NGINX configuration file will be located at:
/etc/nginx/nginx.conf
An example server block configuration can be found in:
/etc/nginx/sites-available/
At this point, you would need to configure NGINX to utilize PHP by editing the server block (see the default example in the above directory for a basic guide) and then restarting NGINX:
sudo service nginx restart
And to ensure PHP-FPM is running:
sudo service php5-fpm start
–
Of course, there’s more to be done and this isn’t an all-inclusive guide. rather, a simple one to show you how to go about getting started without having to manually configure NGINX & PHP (though you can do that as well, it’s just a bit more time consuming).