Nginx/PHP7/MySQL

This manual adapt for installing ander OS Ubuntu Server. For use on another Linus dist, try specific commands (ex. yum instead apt-get).

This manual describes the installation without using VESTACP hosting panel.

1. Update package tree

$ sudo apt-get update

2. Install additional

$ sudo apt-get install build-essential

3. Install NGINX-server

$ sudo apt-get install nginx

4. Install MySQL & configs

$ sudo apt-get install mysql-server
$ sudo mysql_install_db
$ sudo mysql_secure_installation

5. Install PHP7

$ sudo add-apt-repository ppa:ondrej/php
$ sudo apt-get install -y language-pack-en-base
$ sudo LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php
$ sudo apt-get install php7.0

6. Install PHP-libs

$ sudo apt-get install php7.0-mysql php7.0-fpm mcrypt php7.0-mcrypt \
php7.0-zip php7.0-curl php7.0-gd php7.0-imap php7.0-ldap php7.0-mbstring

7. Install REDIS-server

$ wget http://download.redis.io/releases/redis-stable.tar.gz
$ tar xzf redis-stable.tar.gz
$ cd redis-stable
$ make
$ sudo make install
$ cd utils
$ sudo ./install_server.sh
$ sudo update-rc.d redis_6379 defaults

8. Install PHP-libs & NodeJS/NPM

$ sudo apt-get install -y php5-imap php5-ldap nodejs npm
$ sudo php5enmod imap
$ sudo service apache2 restart
$ sudo ln -s /usr/bin/nodejs /usr/bin/node

9. Install NodeJS-libs

$ sudo npm install dotenv --save -g
$ sudo npm install pm2 -g
$ sudo npm install express socket.io ioredis dotenv
$ sudo cd /home/admin/web/YOUR_DOMAIN/public_html/nodejs/
$ sudo pm2 start server.js -n zenserver --watch
$ sudo pm2 startup
$ sudo pm2 save
$ sudo pm2 install pm2-logrotate

10. Edit nginx.conf (eg. /home/admin/conf/web/nginx.conf)

 		 location / {
 		 	try_files $uri $uri/ /index.php?$query_string;
 		 }
  		
                 location /socket.io {
  		   proxy_set_header Upgrade $http_upgrade;
  		   proxy_set_header Connection "upgrade";
  		   proxy_http_version 1.1;
  		   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  		   proxy_set_header Host $host;
  		   proxy_pass http://127.0.0.1:3001/socket.io/;
  		 }

11. Edit nginx.conf

instead this 

root        /home/admin/web/YOUR_DOMAIN/public_html;

to this

root        /home/admin/web/YOUR_DOMAIN/public_html/public;

12. Restart nginx-server

$ sudo service nginx restart

13. Add database

$ CREATE DATABASE zenlix

14. Unpack arch, rename .env.example to .env and go to http://YOUR_DOMAIN/ using:

		DB host: localhost
		DB user: root
		DB name: zenlix
		DB user password: YOUR_PASSWORD

15. Add cron-task

* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1

16. Install SUPEVISOR-service

$ sudo apt-get install supervisor


17. Configure supervisor-service


$ sudo nano /etc/supervisor/conf.d/laravel-worker.conf
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /home/admin/web/YOUR_DOMAIN/public_html/artisan queue:work --sleep=3 --tries=3 --daemon
autostart=true
autorestart=true
user=admin
numprocs=8


18. Restart supervisor-service

$ sudo supervisorctl reread
$ sudo supervisorctl update
$ sudo supervisorctl start laravel-worker:*



19. Try ZENLIX, go to WEB, using login/password:

login: admin@local
password: p@ssw0rd