Last active
April 17, 2018 05:13
-
-
Save louanfontenele/a412e884d843f2ab3f64a2a153c76be0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
su | |
sudo apt-get install sysv-rc-conf | |
sudo apt-get install nginx | |
sudo systemctl start nginx.service | |
sudo systemctl enable nginx.service | |
sudo systemctl status nginx.service | |
sudo service nginx start | |
sudo service nginx status | |
sudo sysv-rc-conf nginx on | |
nginx -v | |
http://localhost (open in your browser) | |
sudo apt-get -y install mariadb-server mariadb-client | |
sudo systemctl start mysql.service | |
sudo systemctl enable mysql.service | |
sudo systemctl status mysql.service | |
sudo service mysql start | |
sudo sysv-rc-conf mysqld on | |
sudo mysql_secure_installation | |
//Enter current password for root (enter for none): Enter Your Current Password | |
//OK, successfully used password, moving on... | |
//Set root password? [Y/n] n | |
// ... skipping. | |
//Remove anonymous users? [Y/n] y | |
// ... Success! | |
//Disallow root login remotely? [Y/n] y | |
// ... Success! | |
//Remove test database and access to it? [Y/n] y | |
// - Dropping test database... | |
// ... Success! | |
// - Removing privileges on test database... | |
// ... Success! | |
//Reload privilege tables now? [Y/n] y | |
// ... Success! | |
//Cleaning up... | |
//All done! If you've completed all of the above steps, your MariaDB | |
//installation should now be secure. | |
//Thanks for using MariaDB! | |
sudo apt-get install -y php7.2 php-geoip php-amqp php-apcu php-igbinary php-imagick php-mongodb php-msgpack php-oauth php-redis php-rrd php-smbclient php-solr php-ssh2 php-uuid php-zmq php-radius php-http php-uploadprogress php-yaml php-all-dev php-xdebug php-memcached php-apcu-bc php-memcache php-tideways php-mailparse php-gnupg php-propro php-raphf php-stomp php-phalcon php-ds php-sass php-lua libapache2-mod-php7.2 libphp7.2-embed php7.2-bcmath php7.2-bz2 php7.2-cgi php7.2-cli php7.2-common php7.2-curl php7.2-dba php7.2-dev php7.2-enchant php7.2-fpm php7.2-gd php7.2-gmp php7.2-imap php7.2-interbase php7.2-intl php7.2-json php7.2-ldap php7.2-mbstring php7.2-mysql php7.2-odbc php7.2-opcache php7.2-pgsql php7.2-phpdbg php7.2-pspell php7.2-readline php7.2-recode php7.2-snmp php7.2-soap php7.2-sqlite3 php7.2-sybase php7.2-tidy php7.2-xml php7.2-xmlrpc php7.2-zip php7.2-xsl | |
//We need to make small changes on php.ini file to make it work php-fpm properly. open php.ini | |
//file on your favorite text editor and find cgi.fix_pathinfo= then uncomment it and change from 1 to 0. | |
sudo nano /etc/php/7.2/fpm/php.ini | |
//By default PHP-FPM listens the socket on fpm.sock and its not effective one. | |
//So we need to change the listening settings on /etc/php5/fpm/pool.d/www.conf & /etc/php/7.2/fpm/pool.d/www.conf. | |
//From listen = /var/run/php5-fpm.sock & listen = /run/php/php7.2-fpm.sock to listen = 127.2.0.1:9000 to listen TCP. | |
//Just open the file www.conf and do it. | |
sudo nano /etc/php/7.2/fpm/pool.d/www.conf | |
;listen = /run/php/php7.2-fpm.sock | |
listen = 127.2.0.1:9000 | |
//Need to make lots of changes on your Nginx default config file to make it Nginx work properly. | |
//Open /etc/nginx/nginx.conf file on your favorite text editor and change worker_processes values according your CPU count. | |
//For CPU count use lscpu command. I’m having 4 CPU’s that’s why i added 4. Also check Nginx User, it should be www-data | |
nano /etc/nginx/nginx.conf | |
=================== | |
user www-data; | |
worker_processes 4; | |
=================== | |
//Open default Virtual host configuration file /etc/nginx/sites-available/default | |
//(I have installed from Ubuntu repository, so my location should be this) on your favorite text editor and uncomment below lines. | |
//Also add/modify below colored lines on your file. | |
//I have removed all the unwanted lines from this file for clear explanation. | |
//Add your FQDN (server.2daygeek.com) instead of us. | |
sudo nano /etc/nginx/sites-available/default | |
//[Web root location & port listening] | |
server | |
{ | |
listen 80 default_server; | |
listen [::]:80 default_server ipv6only=on; | |
root /usr/share/nginx/html; | |
index index.php index.html index.htm; | |
server_name server.2daygeek.com; | |
//[Redirect server error pages to the static page] | |
location / | |
{ | |
try_files $uri $uri/ /index.php; | |
} | |
error_page 404 /404.html; | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html | |
{ | |
root /usr/share/nginx/html; | |
} | |
//[Pass the PHP scripts to FastCGI server] | |
location ~ \.php$ | |
{ | |
fastcgi_split_path_info ^(.+\.php)(/.+)$; | |
try_files $uri =404; | |
fastcgi_pass 127.2.0.1:9000; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_index index.php; | |
include fastcgi_params; | |
} | |
} | |
sudo nano /usr/share/nginx/html/phpinfo.php | |
=========== | |
<?php | |
phpinfo(); | |
?> | |
=========== | |
sudo nginx -t | |
sudo systemctl reload nginx.service | |
sudo systemctl restart nginx.service | |
sudo systemctl restart php7.2-fpm.service | |
sudo service nginx reload | |
sudo service nginx restart | |
sudo service php7.2-fpm restart | |
sudo apt-get -y install phpmyadmin | |
chmod -R 777 /usr/share/nginx/ | |
chmod -R 777 /usr/share/nginx/html | |
ln -s /usr/share/phpmyadmin /usr/share/nginx/html | |
chmod -R 777 /usr/share/nginx/html/phpmyadmin | |
sudo systemctl restart nginx.service | |
sudo service nginx restart | |
//Enter the UserName: phpmyadmin | |
//and password which you set. | |
//Source: http://www.2daygeek.com/install-lemp-server-nginx-mariadb-php-phpmyadmin-on-linuxmint/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment