Skip to content

Instantly share code, notes, and snippets.

@louanfontenele
Last active April 17, 2018 05:13
Show Gist options
  • Select an option

  • Save louanfontenele/a412e884d843f2ab3f64a2a153c76be0 to your computer and use it in GitHub Desktop.

Select an option

Save louanfontenele/a412e884d843f2ab3f64a2a153c76be0 to your computer and use it in GitHub Desktop.

Revisions

  1. louanbastos revised this gist Apr 17, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion LEMP-7.2.txt
    Original file line number Diff line number Diff line change
    @@ -66,7 +66,7 @@ sudo mysql_secure_installation
    //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-yac php-zmq php-radius php-http php-uploadprogress php-yaml php-all-dev php-xdebug php-memcached php-apcu-bc php-memcache php-gmagick php-tideways php-mailparse php-gnupg php-propro php-raphf php-stomp php-gearman 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
    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
  2. louanbastos renamed this gist Apr 17, 2018. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. louanbastos revised this gist Apr 17, 2018. 1 changed file with 1 addition and 4 deletions.
    5 changes: 1 addition & 4 deletions LEMP-7.0.txt
    Original file line number Diff line number Diff line change
    @@ -66,10 +66,7 @@ sudo mysql_secure_installation
    //Thanks for using MariaDB!


    sudo apt-get install -y php7.2 php7.2-fpm php7.2-mysql php7.2-mbstring php7.2-common php7.2-gd php-gettext php7.2-curl php7.2-cli php7.2-xml
    sudo apt-get install -y php-mbstring php7.2-mbstring php-gettext libapache2-mod-php7.2
    sudo apt-get install php7.2-cli php7.2-fpm php7.2-mysql php7.2-curl php-memcached php7.2-dev php7.2-sqlite3 php7.2-mbstring php7.2-gd php7.2-json php7.2-xmlrpc php7.2-xml php7.2-zip
    sudo apt-get install php-pear php7.2-curl php7.2-dev php7.2-gd php7.2-mbstring php7.2-zip php7.2-mysql php7.2-xml
    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-yac php-zmq php-radius php-http php-uploadprogress php-yaml php-all-dev php-xdebug php-memcached php-apcu-bc php-memcache php-gmagick php-tideways php-mailparse php-gnupg php-propro php-raphf php-stomp php-gearman 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
  4. louanbastos revised this gist Apr 17, 2018. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions LEMP-7.0.txt
    Original file line number Diff line number Diff line change
    @@ -68,6 +68,8 @@ sudo mysql_secure_installation

    sudo apt-get install -y php7.2 php7.2-fpm php7.2-mysql php7.2-mbstring php7.2-common php7.2-gd php-gettext php7.2-curl php7.2-cli php7.2-xml
    sudo apt-get install -y php-mbstring php7.2-mbstring php-gettext libapache2-mod-php7.2
    sudo apt-get install php7.2-cli php7.2-fpm php7.2-mysql php7.2-curl php-memcached php7.2-dev php7.2-sqlite3 php7.2-mbstring php7.2-gd php7.2-json php7.2-xmlrpc php7.2-xml php7.2-zip
    sudo apt-get install php-pear php7.2-curl php7.2-dev php7.2-gd php7.2-mbstring php7.2-zip php7.2-mysql php7.2-xml


    //We need to make small changes on php.ini file to make it work php-fpm properly. open php.ini
  5. louanbastos revised this gist Apr 17, 2018. 1 changed file with 11 additions and 11 deletions.
    22 changes: 11 additions & 11 deletions LEMP-7.0.txt
    Original file line number Diff line number Diff line change
    @@ -66,23 +66,23 @@ sudo mysql_secure_installation
    //Thanks for using MariaDB!


    sudo apt-get install -y php7.0 php7.0-fpm php7.0-mysql php7.0-mbstring php7.0-common php7.0-gd php7.0-mcrypt php-gettext php7.0-curl php7.0-cli php7.0-xml
    sudo apt-get install -y php-mbstring php7.0-mbstring php-gettext libapache2-mod-php7.0
    sudo apt-get install -y php7.2 php7.2-fpm php7.2-mysql php7.2-mbstring php7.2-common php7.2-gd php-gettext php7.2-curl php7.2-cli php7.2-xml
    sudo apt-get install -y php-mbstring php7.2-mbstring php-gettext libapache2-mod-php7.2


    //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.0/fpm/php.ini
    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.0/fpm/pool.d/www.conf.
    //From listen = /var/run/php5-fpm.sock & listen = /run/php/php7.0-fpm.sock to listen = 127.0.0.1:9000 to listen TCP.
    //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.0/fpm/pool.d/www.conf
    ;listen = /run/php/php7.0-fpm.sock
    sudo nano /etc/php/7.2/fpm/pool.d/www.conf
    ;listen = /run/php/php7.2-fpm.sock

    listen = 127.0.0.1:9000
    listen = 127.2.0.1:9000


    //Need to make lots of changes on your Nginx default config file to make it Nginx work properly.
    @@ -130,7 +130,7 @@ sudo nano /etc/nginx/sites-available/default
    {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    try_files $uri =404;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_pass 127.2.0.1:9000;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_index index.php;
    include fastcgi_params;
    @@ -151,12 +151,12 @@ sudo nginx -t
    sudo systemctl reload nginx.service
    sudo systemctl restart nginx.service

    sudo systemctl restart php7.0-fpm.service
    sudo systemctl restart php7.2-fpm.service

    sudo service nginx reload
    sudo service nginx restart

    sudo service php7.0-fpm restart
    sudo service php7.2-fpm restart


    sudo apt-get -y install phpmyadmin
  6. louanbastos revised this gist Oct 17, 2016. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions LEMP-7.0.txt
    Original file line number Diff line number Diff line change
    @@ -160,7 +160,11 @@ sudo service php7.0-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
  7. louanbastos renamed this gist Oct 17, 2016. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  8. louanbastos revised this gist Oct 17, 2016. 1 changed file with 157 additions and 0 deletions.
    157 changes: 157 additions & 0 deletions LEMP 7.0
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,174 @@
    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.0 php7.0-fpm php7.0-mysql php7.0-mbstring php7.0-common php7.0-gd php7.0-mcrypt php-gettext php7.0-curl php7.0-cli php7.0-xml
    sudo apt-get install -y php-mbstring php7.0-mbstring php-gettext libapache2-mod-php7.0


    //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.0/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.0/fpm/pool.d/www.conf.
    //From listen = /var/run/php5-fpm.sock & listen = /run/php/php7.0-fpm.sock to listen = 127.0.0.1:9000 to listen TCP.
    //Just open the file www.conf and do it.
    sudo nano /etc/php/7.0/fpm/pool.d/www.conf
    ;listen = /run/php/php7.0-fpm.sock

    listen = 127.0.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.0.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.0-fpm.service

    sudo service nginx reload
    sudo service nginx restart

    sudo service php7.0-fpm restart


    sudo apt-get -y install phpmyadmin
    ln -s /usr/share/phpmyadmin /usr/share/nginx/html


    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/
  9. louanbastos revised this gist Oct 17, 2016. 1 changed file with 15 additions and 0 deletions.
    15 changes: 15 additions & 0 deletions LEMP 7.0
    Original file line number Diff line number Diff line change
    @@ -1,2 +1,17 @@
    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)

  10. louanbastos created this gist Oct 17, 2016.
    2 changes: 2 additions & 0 deletions LEMP 7.0
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    su
    sudo apt-get install sysv-rc-conf