Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. mehdi89 revised this gist Mar 31, 2021. 1 changed file with 2 additions and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    sudo add-apt-repository ppa:nginx/stable ppa:ondrej/php -y
    sudo add-apt-repository ppa:nginx/stable -y
    sudo add-apt-repository ppa:ondrej/php -y
    sudo apt update
    sudo apt-get install nginx -y
    sudo apt-get install zip unzip php7.4 php7.4-mysql php7.4-fpm php7.4-xml php7.4-gd php7.4-opcache php7.4-mbstring php7.4-zip -y
  2. mehdi89 revised this gist Mar 25, 2021. 2 changed files with 6 additions and 7 deletions.
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,7 @@
    sudo apt-get update
    sudo add-apt-repository ppa:nginx/stable
    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update
    sudo apt-get install nginx
    sudo apt-get install php7.4 php7.4-mysql php7.4-fpm php7.4-xml php7.4-gd php7.4-opcache php7.4-mbstring
    sudo apt install zip unzip php7.4-zip
    sudo add-apt-repository ppa:nginx/stable ppa:ondrej/php -y
    sudo apt update
    sudo apt-get install nginx -y
    sudo apt-get install zip unzip php7.4 php7.4-mysql php7.4-fpm php7.4-xml php7.4-gd php7.4-opcache php7.4-mbstring php7.4-zip -y

    #install composer
    curl -sS https://getcomposer.org/installer | php
    2 changes: 2 additions & 0 deletions 02 Getting Laravel up & running
    Original file line number Diff line number Diff line change
    @@ -6,6 +6,8 @@ sudo chmod -R 775 tutorial/

    #cd /etc/nginx/sites-available
    #sudo nano tutorial.conf
    #copy paste the content of below nginx config file

    #cd /etc/nginx/sites-enabled
    #sudo rm -rf default
    #sudo ln -s ../sites-available/tutorial.conf .
  3. mehdi89 revised this gist Mar 18, 2021. 3 changed files with 0 additions and 0 deletions.
    File renamed without changes.
  4. mehdi89 revised this gist Mar 18, 2021. 3 changed files with 4 additions and 3 deletions.
    1 change: 1 addition & 0 deletions Geting Laravel up & running
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    cd /var/www/html
    sudo composer create-project laravel/laravel tutorial --prefer-dist
    sudo chown -R www-data:ubuntu tutorial/
    sudo chmod -R 775 tutorial/
    Original file line number Diff line number Diff line change
    @@ -3,8 +3,8 @@ sudo add-apt-repository ppa:nginx/stable
    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update
    sudo apt-get install nginx
    sudo apt-get install php7.2 php7.2-mysql php7.2-fpm php7.2-xml php7.2-gd php7.2-opcache php7.2-mbstring
    sudo apt install zip unzip php7.2-zip
    sudo apt-get install php7.4 php7.4-mysql php7.4-fpm php7.4-xml php7.4-gd php7.4-opcache php7.4-mbstring
    sudo apt install zip unzip php7.4-zip

    #install composer
    curl -sS https://getcomposer.org/installer | php
    2 changes: 1 addition & 1 deletion nginx config file (tutorial.conf)
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ server {
    error_page 404 /index.php;

    location ~ \.php$ {
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    include fastcgi_params;
  5. mehdi89 revised this gist Nov 5, 2019. 2 changed files with 2 additions and 2 deletions.
    2 changes: 1 addition & 1 deletion Geting Laravel up & running
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    sudo composer create-project laravel/laravel tutorial --prefer-dist
    sudo chown -R www-data:www-data tutorial/
    sudo chown -R www-data:ubuntu tutorial/
    sudo chmod -R 775 tutorial/


    Original file line number Diff line number Diff line change
    @@ -6,6 +6,6 @@ sudo apt-get install nginx
    sudo apt-get install php7.2 php7.2-mysql php7.2-fpm php7.2-xml php7.2-gd php7.2-opcache php7.2-mbstring
    sudo apt install zip unzip php7.2-zip

    #composer
    #install composer
    curl -sS https://getcomposer.org/installer | php
    sudo mv composer.phar /usr/local/bin/composer
  6. mehdi89 revised this gist Nov 5, 2019. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions If composer memory error
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,4 @@
    sudo fallocate -l 1G /swapfile
    sudo mkswap /swapfile
    sudo swapon /swapfile
    #https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-an-nginx-web-server-on-ubuntu-14-04#create-swap-file-(optional)
  7. mehdi89 revised this gist Nov 3, 2019. 1 changed file with 22 additions and 10 deletions.
    32 changes: 22 additions & 10 deletions nginx config file (tutorial.conf)
    Original file line number Diff line number Diff line change
    @@ -1,21 +1,33 @@

    server {
    listen 80 default_server;
    listen [::]:80 default_server;

    listen 80;
    server_name example.com;
    root /var/www/html/tutorial/public;

    index index.php index.html index.htm index.nginx-debian.html;
    server_name _;
    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    location / {
    try_files $uri $uri/ =404;
    try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    # With php-fpm (or other unix sockets);
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    # With php-fpm (or other unix sockets);
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
    include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
    deny all;
    }
    }
  8. mehdi89 revised this gist Nov 3, 2019. 3 changed files with 0 additions and 0 deletions.
  9. mehdi89 revised this gist Nov 3, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 3. etc nginx sites-available tutorial.conf
    Original file line number Diff line number Diff line change
    @@ -3,7 +3,7 @@ server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/test/public;
    root /var/www/html/tutorial/public;

    index index.php index.html index.htm index.nginx-debian.html;
    server_name _;
  10. mehdi89 revised this gist Nov 3, 2019. 3 changed files with 25 additions and 0 deletions.
    File renamed without changes.
    Original file line number Diff line number Diff line change
    @@ -4,5 +4,9 @@ sudo chmod -R 775 tutorial/


    #cd /etc/nginx/sites-available
    #sudo nano tutorial.conf
    #cd /etc/nginx/sites-enabled
    #sudo rm -rf default
    #sudo ln -s ../sites-available/tutorial.conf .
    #sudo nginx -t
    #sudo service nginx restart
    21 changes: 21 additions & 0 deletions 3. etc nginx sites-available tutorial.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@

    server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/test/public;

    index index.php index.html index.htm index.nginx-debian.html;
    server_name _;

    location / {
    try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
    include snippets/fastcgi-php.conf;
    # With php-fpm (or other unix sockets);
    fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
    # With php-fpm (or other unix sockets);
    }
    }
  11. mehdi89 revised this gist Nov 3, 2019. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Geting Laravel up & running
    Original file line number Diff line number Diff line change
    @@ -3,6 +3,6 @@ sudo chown -R www-data:www-data tutorial/
    sudo chmod -R 775 tutorial/


    #cd /etc/nginx/sites/available
    #cd /etc/nginx/sites-available
    #sudo nginx -t
    #sudo service nginx restart
  12. mehdi89 revised this gist Nov 3, 2019. 2 changed files with 9 additions and 2 deletions.
    8 changes: 8 additions & 0 deletions Geting Laravel up & running
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    sudo composer create-project laravel/laravel tutorial --prefer-dist
    sudo chown -R www-data:www-data tutorial/
    sudo chmod -R 775 tutorial/


    #cd /etc/nginx/sites/available
    #sudo nginx -t
    #sudo service nginx restart
    3 changes: 1 addition & 2 deletions Getting server ready
    Original file line number Diff line number Diff line change
    @@ -3,8 +3,7 @@ sudo add-apt-repository ppa:nginx/stable
    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update
    sudo apt-get install nginx
    sudo apt-get install php7.2 php7.2-msql php7.2-mysql php7.2-fpm php7.2-xml php7.2-gd php7.2-opcache php7.2-mbstring
    sudo apt install php7.2-cli
    sudo apt-get install php7.2 php7.2-mysql php7.2-fpm php7.2-xml php7.2-gd php7.2-opcache php7.2-mbstring
    sudo apt install zip unzip php7.2-zip

    #composer
  13. mehdi89 revised this gist Nov 3, 2019. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Getting server ready
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,7 @@ sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update
    sudo apt-get install nginx
    sudo apt-get install php7.2 php7.2-msql php7.2-mysql php7.2-fpm php7.2-xml php7.2-gd php7.2-opcache php7.2-mbstring
    sudo apt install php7.2-cli
    sudo apt install zip unzip php7.2-zip

    #composer
  14. mehdi89 revised this gist Nov 3, 2019. 1 changed file with 1 addition and 3 deletions.
    4 changes: 1 addition & 3 deletions Getting server ready
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,5 @@
    sudo apt-get update
    sudo nginx=stable
    sudo add-apt-repository ppa:nginx/$nginx
    sudo apt-get install python-software-properties
    sudo add-apt-repository ppa:nginx/stable
    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update
    sudo apt-get install nginx
  15. mehdi89 created this gist Nov 3, 2019.
    13 changes: 13 additions & 0 deletions Getting server ready
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    sudo apt-get update
    sudo nginx=stable
    sudo add-apt-repository ppa:nginx/$nginx
    sudo apt-get install python-software-properties
    sudo add-apt-repository ppa:ondrej/php
    sudo apt-get update
    sudo apt-get install nginx
    sudo apt-get install php7.2 php7.2-msql php7.2-mysql php7.2-fpm php7.2-xml php7.2-gd php7.2-opcache php7.2-mbstring
    sudo apt install zip unzip php7.2-zip

    #composer
    curl -sS https://getcomposer.org/installer | php
    sudo mv composer.phar /usr/local/bin/composer