Skip to content

Instantly share code, notes, and snippets.

@mannysoft
Last active March 23, 2022 07:25
Show Gist options
  • Select an option

  • Save mannysoft/f7670c13861fe7b5d6aae639966580d1 to your computer and use it in GitHub Desktop.

Select an option

Save mannysoft/f7670c13861fe7b5d6aae639966580d1 to your computer and use it in GitHub Desktop.

Revisions

  1. mannysoft revised this gist Mar 23, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion php80.install
    Original file line number Diff line number Diff line change
    @@ -137,7 +137,7 @@ sudo certbot --nginx -d example.com -d www.example.com
    #https://hackprogramming.com/how-to-setup-subdomain-or-host-multiple-domains-using-nginx-in-linux-server/

    # Install MailHog for email testing
    # https://mannyisles.com/install-mailhog-with-nginx-on-ubuntu-server/
    # https://gist.github.com/mannysoft/a0238f5c33c4c294064ec5f563564961

    # Install supervisor
    sudo apt-get install supervisor -y
  2. mannysoft revised this gist Nov 3, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion php80.install
    Original file line number Diff line number Diff line change
    @@ -89,7 +89,7 @@ EOF

    # set client body size to 2M #
    # Add the following line to http or server or location context to increase the size limit in nginx.conf, enter:
    client_max_body_size 2M;
    client_max_body_size 20M;

    echo "--- Restarting php8.0-fpm and Nginx ---"
    sudo systemctl restart php8.0-fpm.service
  3. mannysoft revised this gist Nov 3, 2021. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions php80.install
    Original file line number Diff line number Diff line change
    @@ -87,6 +87,10 @@ server {
    EOF


    # set client body size to 2M #
    # Add the following line to http or server or location context to increase the size limit in nginx.conf, enter:
    client_max_body_size 2M;

    echo "--- Restarting php8.0-fpm and Nginx ---"
    sudo systemctl restart php8.0-fpm.service
    sudo systemctl restart nginx.service
  4. mannysoft revised this gist Nov 3, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions php80.install
    Original file line number Diff line number Diff line change
    @@ -27,6 +27,7 @@ sudo apt-get update
    sudo apt-get install -y mysql-server
    sudo mysql_secure_installation
    # https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-18-04
    # If access denied https://phoenixnap.com/kb/access-denied-for-user-root-localhost


    echo "--- Installing PHP-specific packages and Curl ---"
  5. mannysoft revised this gist Sep 2, 2021. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion php80.install
    Original file line number Diff line number Diff line change
    @@ -147,4 +147,6 @@ sudo apt-get install supervisor -y
    # https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
    sudo apt-get install php-mongodb
    # Using Mac
    pecl install mongodb
    pecl install mongodb
    # Check
    php -i | grep mongodb
  6. mannysoft revised this gist Sep 2, 2021. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion php80.install
    Original file line number Diff line number Diff line change
    @@ -145,4 +145,6 @@ sudo apt-get install supervisor -y

    # MongoDB
    # https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
    sudo apt-get install php-mongodb
    sudo apt-get install php-mongodb
    # Using Mac
    pecl install mongodb
  7. mannysoft revised this gist Sep 1, 2021. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions php80.install
    Original file line number Diff line number Diff line change
    @@ -139,6 +139,10 @@ sudo apt-get install supervisor -y

    # https://laravel.com/docs/7.x/queues#running-the-queue-worker

    # Nginx file upload
    # https://www.tecmint.com/limit-file-upload-size-in-nginx/
    # client_max_body_size 100M;

    # MongoDB
    # https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
    sudo apt-get install php-mongodb
  8. mannysoft revised this gist Aug 3, 2021. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions php80.install
    Original file line number Diff line number Diff line change
    @@ -123,10 +123,9 @@ sudo reboot

    # Install SSL Certificate
    # https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04
    sudo add-apt-repository ppa:certbot/certbot
    sudo apt-get update
    sudo apt-get install certbot
    sudo apt-get install python-certbot-nginx or sudo apt-get install python3-certbot-nginx
    sudo apt-get install python3-certbot-nginx
    sudo certbot --nginx -d example.com -d www.example.com

    # Set up subdomain
  9. mannysoft revised this gist Jul 11, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion php80.install
    Original file line number Diff line number Diff line change
    @@ -30,7 +30,7 @@ sudo mysql_secure_installation


    echo "--- Installing PHP-specific packages and Curl ---"
    sudo apt-get -y install nginx php8.0 php8.0-cli php8.0-common php8.0-opcache php8.0-mysql php8.0-fpm php8.0-ldap php8.0-tidy php8.0-bcmath php8.0-mbstring php8.0-xml php8.0-curl php8.0-zip php8.0-gd php8.0-sqlite3 php8.0-redis --allow-unauthenticated
    sudo apt-get -y install nginx php8.0 php8.0-cli php8.0-common php8.0-opcache php8.0-mysql php8.0-fpm php8.0-ldap php8.0-tidy php8.0-bcmath php8.0-mbstring php8.0-xml php8.0-curl php8.0-zip php8.0-gd php8.0-sqlite3 php8.0-redis php8.0-intl --allow-unauthenticated

    echo "--- Applying modifications to php8.0-fpm ---"
    sudo sed -i '/cgi.fix_pathinfo=1/c cgi.fix_pathinfo=0' /etc/php/8.0/cli/php.ini
  10. mannysoft revised this gist Jul 11, 2021. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion php80.install
    Original file line number Diff line number Diff line change
    @@ -125,7 +125,8 @@ sudo reboot
    # https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04
    sudo add-apt-repository ppa:certbot/certbot
    sudo apt-get update
    sudo apt-get install python-certbot-nginx
    sudo apt-get install certbot
    sudo apt-get install python-certbot-nginx or sudo apt-get install python3-certbot-nginx
    sudo certbot --nginx -d example.com -d www.example.com

    # Set up subdomain
  11. mannysoft revised this gist Jul 11, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion php80.install
    Original file line number Diff line number Diff line change
    @@ -110,7 +110,7 @@ sudo apt-get install -y npm --allow-unauthenticated
    sudo chown -R www-data /var/www
    # sudo chmod -R 775 /var/www/app/storage

    echo "--- Restarting php7.4-fpm and Nginx ---"
    echo "--- Restarting php8.0-fpm and Nginx ---"
    sudo systemctl restart php8.0-fpm.service
    sudo systemctl restart nginx.service

  12. mannysoft revised this gist Jul 11, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion php80.install
    Original file line number Diff line number Diff line change
    @@ -32,7 +32,7 @@ sudo mysql_secure_installation
    echo "--- Installing PHP-specific packages and Curl ---"
    sudo apt-get -y install nginx php8.0 php8.0-cli php8.0-common php8.0-opcache php8.0-mysql php8.0-fpm php8.0-ldap php8.0-tidy php8.0-bcmath php8.0-mbstring php8.0-xml php8.0-curl php8.0-zip php8.0-gd php8.0-sqlite3 php8.0-redis --allow-unauthenticated

    echo "--- Applying modifications to php7.4-fpm ---"
    echo "--- Applying modifications to php8.0-fpm ---"
    sudo sed -i '/cgi.fix_pathinfo=1/c cgi.fix_pathinfo=0' /etc/php/8.0/cli/php.ini
    sudo sed -i '/max_execution_time = 30/c max_execution_time = 300' /etc/php/8.0/cli/php.ini
    sudo sed -i '/upload_max_filesize = 2M/c upload_max_filesize = 80M' /etc/php/8.0/cli/php.ini
  13. mannysoft revised this gist Jul 11, 2021. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions php80.install
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,9 @@
    # chmod +x install.sh
    # ./install.sh

    # For upgrade from PHP 7.4 to 8.0
    # https://chasingcode.dev/blog/upgrade-php-7-4-to-8-ubuntu/

    echo "--- Welcome User. This is very exciting. ---"

    echo "--- Updating packages list ---"
  14. mannysoft revised this gist Apr 11, 2021. 1 changed file with 0 additions and 2 deletions.
    2 changes: 0 additions & 2 deletions php80.install
    Original file line number Diff line number Diff line change
    @@ -2,8 +2,6 @@
    # curl -LO https://gist.github.com/mannysoft/e4b54662b3aec5c0b1b88be52177ab68/raw/04dba433394c7a03d891f94c75b52975d2e7a621/install.sh
    # chmod +x install.sh
    # ./install.sh
    # ppk to pem:
    # puttygen key.ppk -O private-openssh -o key.pem

    echo "--- Welcome User. This is very exciting. ---"

  15. mannysoft revised this gist Apr 11, 2021. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions php80.install
    Original file line number Diff line number Diff line change
    @@ -76,7 +76,7 @@ server {
    location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    fastcgi_pass unix:/var/run/php/php8.0-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    @@ -85,9 +85,9 @@ server {
    EOF


    echo "--- Restarting php7.4-fpm and Nginx ---"
    sudo /etc/init.d/nginx restart
    sudo /etc/init.d/php7.4-fpm restart
    echo "--- Restarting php8.0-fpm and Nginx ---"
    sudo systemctl restart php8.0-fpm.service
    sudo systemctl restart nginx.service

    # Create Swap File (Optional)
    # sudo fallocate -l 1G /swapfile
    @@ -110,8 +110,8 @@ sudo chown -R www-data /var/www
    # sudo chmod -R 775 /var/www/app/storage

    echo "--- Restarting php7.4-fpm and Nginx ---"
    sudo /etc/init.d/nginx restart
    sudo /etc/init.d/php7.4-fpm restart
    sudo systemctl restart php8.0-fpm.service
    sudo systemctl restart nginx.service

    #phpmyadmin
    #sudo apt-get install -y --allow-unauthenticated phpmyadmin
  16. mannysoft revised this gist Apr 11, 2021. 1 changed file with 9 additions and 9 deletions.
    18 changes: 9 additions & 9 deletions php80.install
    Original file line number Diff line number Diff line change
    @@ -32,23 +32,23 @@ echo "--- Installing PHP-specific packages and Curl ---"
    sudo apt-get -y install nginx php8.0 php8.0-cli php8.0-common php8.0-opcache php8.0-mysql php8.0-fpm php8.0-ldap php8.0-tidy php8.0-bcmath php8.0-mbstring php8.0-xml php8.0-curl php8.0-zip php8.0-gd php8.0-sqlite3 php8.0-redis --allow-unauthenticated

    echo "--- Applying modifications to php7.4-fpm ---"
    sudo sed -i '/cgi.fix_pathinfo=1/c cgi.fix_pathinfo=0' /etc/php/7.4/cli/php.ini
    sudo sed -i '/max_execution_time = 30/c max_execution_time = 300' /etc/php/7.4/cli/php.ini
    sudo sed -i '/upload_max_filesize = 2M/c upload_max_filesize = 80M' /etc/php/7.4/cli/php.ini
    sudo sed -i '/post_max_size = 8M/c post_max_size = 80M' /etc/php/7.4/cli/php.ini

    sudo sed -i '/upload_max_filesize = 2M/c upload_max_filesize = 80M' /etc/php/7.4/fpm/php.ini
    sudo sed -i '/post_max_size = 8M/c post_max_size = 80M' /etc/php/7.4/fpm/php.ini
    sudo sed -i '/cgi.fix_pathinfo=1/c cgi.fix_pathinfo=0' /etc/php/8.0/cli/php.ini
    sudo sed -i '/max_execution_time = 30/c max_execution_time = 300' /etc/php/8.0/cli/php.ini
    sudo sed -i '/upload_max_filesize = 2M/c upload_max_filesize = 80M' /etc/php/8.0/cli/php.ini
    sudo sed -i '/post_max_size = 8M/c post_max_size = 80M' /etc/php/8.0/cli/php.ini
    sudo sed -i '/upload_max_filesize = 2M/c upload_max_filesize = 80M' /etc/php/8.0/fpm/php.ini
    sudo sed -i '/post_max_size = 8M/c post_max_size = 80M' /etc/php/8.0/fpm/php.ini

    echo "--- Check if no error in nginx ----"
    sudo nginx -t

    echo "--- Restart PHP-FPM if everything is ok ---"
    sudo systemctl restart php7.4-fpm.service
    sudo systemctl restart php8.0-fpm.service
    sudo systemctl restart nginx.service

    echo "--- Enable Nginx and PHP-FPM on system boot ---"
    sudo systemctl enable nginx.service
    sudo systemctl enable php7.4-fpm.service
    sudo systemctl enable php8.0-fpm.service

    # Create folder
    sudo mkdir -p /var/www/app
  17. mannysoft revised this gist Apr 11, 2021. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions php80.install
    Original file line number Diff line number Diff line change
    @@ -11,6 +11,7 @@ echo "--- Updating packages list ---"
    sudo apt-get install software-properties-common
    #https://colorfield.be/blog/fix-following-signatures-couldnt-be-verified-because-public-key-not-available-ubuntu-1604
    sudo add-apt-repository ppa:ondrej/nginx
    sudo add-apt-repository ppa:ondrej/nginx-mainline
    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update

  18. mannysoft revised this gist Apr 11, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion php80.install
    Original file line number Diff line number Diff line change
    @@ -28,7 +28,7 @@ sudo mysql_secure_installation


    echo "--- Installing PHP-specific packages and Curl ---"
    sudo apt-get -y install nginx php7.4 php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-mysql php7.4-fpm php7.4-ldap php7.4-tidy php7.4-bcmath php7.4-mbstring php7.4-xml php7.4-curl php7.4-zip php7.4-gd php7.4-sqlite3 php7.4-redis --allow-unauthenticated
    sudo apt-get -y install nginx php8.0 php8.0-cli php8.0-common php8.0-opcache php8.0-mysql php8.0-fpm php8.0-ldap php8.0-tidy php8.0-bcmath php8.0-mbstring php8.0-xml php8.0-curl php8.0-zip php8.0-gd php8.0-sqlite3 php8.0-redis --allow-unauthenticated

    echo "--- Applying modifications to php7.4-fpm ---"
    sudo sed -i '/cgi.fix_pathinfo=1/c cgi.fix_pathinfo=0' /etc/php/7.4/cli/php.ini
  19. mannysoft created this gist Apr 11, 2021.
    142 changes: 142 additions & 0 deletions php80.install
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,142 @@
    #!/usr/bin/env bash
    # curl -LO https://gist.github.com/mannysoft/e4b54662b3aec5c0b1b88be52177ab68/raw/04dba433394c7a03d891f94c75b52975d2e7a621/install.sh
    # chmod +x install.sh
    # ./install.sh
    # ppk to pem:
    # puttygen key.ppk -O private-openssh -o key.pem

    echo "--- Welcome User. This is very exciting. ---"

    echo "--- Updating packages list ---"
    sudo apt-get install software-properties-common
    #https://colorfield.be/blog/fix-following-signatures-couldnt-be-verified-because-public-key-not-available-ubuntu-1604
    sudo add-apt-repository ppa:ondrej/nginx
    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update

    echo "--- Installing text editor NANO ---"
    sudo apt-get install -y nano

    echo "--- Installing git ---"
    sudo apt-get install -y git-core

    echo "--- Installing MySQL ---"
    sudo apt-get update
    sudo apt-get install -y mysql-server
    sudo mysql_secure_installation
    # https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-18-04


    echo "--- Installing PHP-specific packages and Curl ---"
    sudo apt-get -y install nginx php7.4 php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-mysql php7.4-fpm php7.4-ldap php7.4-tidy php7.4-bcmath php7.4-mbstring php7.4-xml php7.4-curl php7.4-zip php7.4-gd php7.4-sqlite3 php7.4-redis --allow-unauthenticated

    echo "--- Applying modifications to php7.4-fpm ---"
    sudo sed -i '/cgi.fix_pathinfo=1/c cgi.fix_pathinfo=0' /etc/php/7.4/cli/php.ini
    sudo sed -i '/max_execution_time = 30/c max_execution_time = 300' /etc/php/7.4/cli/php.ini
    sudo sed -i '/upload_max_filesize = 2M/c upload_max_filesize = 80M' /etc/php/7.4/cli/php.ini
    sudo sed -i '/post_max_size = 8M/c post_max_size = 80M' /etc/php/7.4/cli/php.ini

    sudo sed -i '/upload_max_filesize = 2M/c upload_max_filesize = 80M' /etc/php/7.4/fpm/php.ini
    sudo sed -i '/post_max_size = 8M/c post_max_size = 80M' /etc/php/7.4/fpm/php.ini

    echo "--- Check if no error in nginx ----"
    sudo nginx -t

    echo "--- Restart PHP-FPM if everything is ok ---"
    sudo systemctl restart php7.4-fpm.service

    echo "--- Enable Nginx and PHP-FPM on system boot ---"
    sudo systemctl enable nginx.service
    sudo systemctl enable php7.4-fpm.service

    # Create folder
    sudo mkdir -p /var/www/app
    sudo mkdir -p /var/www/app/public

    echo "--- Configuring default Nginx site to support Laravel ---"
    cat << 'EOF' | sudo tee /etc/nginx/sites-available/default
    server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;
    root /var/www/app/public;
    index index.php index.html index.htm;
    # Make site accessible from http://localhost/
    server_name localhost;
    location / {
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ /index.php?$query_string;
    # Uncomment to enable naxsi on this location
    # include /etc/nginx/naxsi.rules
    }
    location ~ \.php$ {
    try_files $uri =404;
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
    }
    }
    EOF


    echo "--- Restarting php7.4-fpm and Nginx ---"
    sudo /etc/init.d/nginx restart
    sudo /etc/init.d/php7.4-fpm restart

    # Create Swap File (Optional)
    # sudo fallocate -l 1G /swapfile
    # sudo mkswap /swapfile
    # sudo swapon /swapfile

    echo "--- Fetching and installing Composer ---"
    sudo curl -sS https://getcomposer.org/installer | php
    sudo mv composer.phar /usr/local/bin/composer

    # echo "--- Installing node.js ---"
    sudo apt-get install -y nodejs --allow-unauthenticated
    sudo apt-get install -y npm --allow-unauthenticated
    #laravel-echo-server start
    #nodejs-legacy


    #sudo chown -R username /var/www/app
    sudo chown -R www-data /var/www
    # sudo chmod -R 775 /var/www/app/storage

    echo "--- Restarting php7.4-fpm and Nginx ---"
    sudo /etc/init.d/nginx restart
    sudo /etc/init.d/php7.4-fpm restart

    #phpmyadmin
    #sudo apt-get install -y --allow-unauthenticated phpmyadmin
    # sudo ln -s /usr/share/phpmyadmin /var/www/app/public

    echo "Rebooting server..."
    sudo reboot

    # Install SSL Certificate
    # https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04
    sudo add-apt-repository ppa:certbot/certbot
    sudo apt-get update
    sudo apt-get install python-certbot-nginx
    sudo certbot --nginx -d example.com -d www.example.com

    # Set up subdomain
    #https://hackprogramming.com/how-to-setup-subdomain-or-host-multiple-domains-using-nginx-in-linux-server/

    # Install MailHog for email testing
    # https://mannyisles.com/install-mailhog-with-nginx-on-ubuntu-server/

    # Install supervisor
    sudo apt-get install supervisor -y

    # https://laravel.com/docs/7.x/queues#running-the-queue-worker

    # MongoDB
    # https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
    sudo apt-get install php-mongodb