Last active
September 15, 2021 20:39
-
-
Save johndavedecano/09c47551404d432474a06c2f5d9c59a9 to your computer and use it in GitHub Desktop.
This file contains 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
sudo snap install --classic certbot | |
sudo certbot --nginx | |
crontab -e | |
12 3 * * * /snap/bin/certbot renew |
This file contains 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
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
server_name _; | |
root /var/www/html/public; | |
add_header X-Frame-Options "SAMEORIGIN"; | |
add_header X-Content-Type-Options "nosniff"; | |
index index.php; | |
charset utf-8; | |
location / { | |
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$ { | |
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; | |
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; | |
include fastcgi_params; | |
} | |
location ~ /\.(?!well-known).* { | |
deny all; | |
} | |
} |
This file contains 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
apt-get update | |
apt-get install -y \ | |
git \ | |
unzip \ | |
zip \ | |
curl \ | |
nginx \ | |
supervisor | |
apt-get install -y \ | |
php7.4-fpm \ | |
php7.4-common \ | |
php7.4-xml \ | |
php7.4-gd \ | |
php7.4-opcache \ | |
php7.4-mbstring \ | |
php7.4-curl \ | |
php7.4-bcmath \ | |
php7.4-iconv \ | |
php7.4-intl \ | |
php7.4-bcmath \ | |
php7.4-mysql \ | |
php7.4-zip \ | |
php7.4-gd \ | |
php7.4-json | |
apt-get install -y php-redis | |
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | |
service php7.4-fpm restart | |
service php7.4-fpm status | |
service nginx restart | |
service nginx status | |
nano /etc/nginx/sites-available/default | |
nano /etc/php/7.4/fpm/conf.d/laravel.ini | |
service php7.4-fpm restart |
This file contains 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
php artisan key:generate | |
chown -R www-data:www-data /var/www/html | |
chmod -R 755 /var/www/html/storage | |
chmod -R 755 /var/www/html/bootstrap/cache | |
php artisan storage:link |
This file contains 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
max_execution_time = 60 | |
memory_limit = 1024M | |
opcache.enable=1 | |
opcache.memory_consumption=512 | |
opcache.interned_strings_buffer=64 | |
opcache.max_accelerated_files=32531 | |
opcache.validate_timestamps=0 | |
opcache.save_comments=1 | |
opcache.fast_shutdown=0 |
This file contains 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
[program:laravel-worker] | |
process_name=%(program_name)s_%(process_num)02d | |
command=php /var/www/html/artisan queue:work database --sleep=3 --tries=3 --max-time=3600 | |
autostart=true | |
autorestart=true | |
stopasgroup=true | |
killasgroup=true | |
user=www-data | |
numprocs=8 | |
redirect_stderr=true | |
stdout_logfile=/var/www/html/worker.log | |
stopwaitsecs=3600 |
This file contains 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
<?php | |
namespace App\Providers; | |
use Illuminate\Database\Events\MigrationsStarted; | |
use Illuminate\Support\Facades\DB; | |
use Illuminate\Support\Facades\Event; | |
use Illuminate\Support\ServiceProvider; | |
class AppServiceProvider extends ServiceProvider { | |
/** | |
* Register any application services. | |
* | |
* @return void | |
*/ | |
public function register() { | |
// check this one here https://github.com/laravel/framework/issues/33238#issuecomment-897063577 | |
Event::listen(MigrationsStarted::class, function (){ | |
if (config('databases.allow_disabled_pk')) { | |
DB::statement('SET SESSION sql_require_primary_key=0'); | |
} | |
}); | |
Event::listen(MigrationsEnded::class, function (){ | |
if (config('databases.allow_disabled_pk')) { | |
DB::statement('SET SESSION sql_require_primary_key=1'); | |
} | |
}); | |
} | |
// rest of the class | |
} |
This file contains 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
sudo supervisorctl reread | |
sudo supervisorctl update | |
sudo supervisorctl start laravel-worker:* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.digitalocean.com/community/questions/how-to-setup-laravel-with-digitalocean-managed-redis-cluster