Skip to content

Instantly share code, notes, and snippets.

@ngobach
Last active May 6, 2016 09:09
Show Gist options
  • Save ngobach/41c1938c029b7a534287 to your computer and use it in GitHub Desktop.
Save ngobach/41c1938c029b7a534287 to your computer and use it in GitHub Desktop.
Ubuntu 14.04 Web server installation

Make swap

sudo fallocate -l 3G /swapfile && \
sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile && \
sudo sh -c 'echo /swapfile   none    swap    sw    0   0 >> /etc/fstab' && \
sudo sh -c 'echo vm.swappiness=10 >> /etc/sysctl.conf' && \
sudo sh -c 'echo vm.vfs_cache_pressure = 50 >> /etc/sysctl.conf'

Install Apache + PHP + MySQL

sudo apt-get -y install apache2 php5 libapache2-mod-php5 php5-mcrypt php5-curl php5-mysql php5-gd php5-cli php5-dev mysql-client mysql-server && \
sudo php5enmod mcrypt mysql && \
sudo service apache2 restart && sudo service mysql restart

Install Composer

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Install Youtube-dl & FFMPEG

sudo curl https://yt-dl.org/downloads/2016.03.25/youtube-dl -o /usr/local/bin/youtube-dl && sudo chmod a+rx /usr/local/bin/youtube-dl

sudo add-apt-repository ppa:mc3man/trusty-media && sudo apt-get update && sudo apt-get install -y ffmpeg

/etc/youtube-dl.conf

-i
--restrict-filenames
-o '%(id)s.%(ext)s'
--write-thumbnail
--write-info-json
-f "best[height <=? 720]"
--max-filesize 3g

Install Supervisor & Laravel worker

Note: Change path to artisan file.

sudo apt-get install -y supervisor && sudo nano /etc/supervisor/conf.d/lar.conf

Paste this:

[program:laravel]
command=php /var/www/site/artisan queue:work --memory=1024 --daemon
autostart=true
autorestart=true
user=www-data
redirect_stderr=true
stdout_logfile=/var/www/site/storage/logs/worker.log

Then run:

sudo supervisorctl update && sudo supervisorctl status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment