sworks


server
{
listen 80;
listen [::]:80;
server_name www.$MY_DOMAIN_NAME;
return 301 http://$MY_DOMAIN_NAME$request_uri;
}
server
{
listen 80;
listen [::]:80;
root /var/www/$MY_DOMAIN_NAME/public;
index index.php index.html index.htm;
server_name $MY_DOMAIN_NAME;
location ~ \.php$
{
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.
{
deny all;
}
location = /favicon.ico
{
log_not_found off;
access_log off;
}
location = /robots.txt
{
log_not_found off;
access_log off;
allow all;
}
include /var/www/$MY_DOMAIN_NAME/.nginx.conf;
}


Bu şekilde yaparsam www. lar www. suz şekilde doğru yönlenir mi?
rwds-root/flarum-script reposunda apache2 kullanarak flarum yükleme scripti paylaşılmış. Ben php'yi sizin kaynağınıza göre güncelledim. 7.4 yaptım. Sizdeki komutlara göre MariaDB 10.1 iniyor. MariaDB 10.4 inecek şekilde güncelledim. Flarum'daki bazı eklentilerde 10.2 üstü öneriliyor. Scripti düzenledim ve dosya aşağıdaki şekilde. Deneyecek boş bir sanal sunucum olmadığı için denemeyemedim. Ubuntu 18.04 için çalışacaktır. SSL otomatik yüklemeyi de ayarlayabilirsek. Güzel bir script olur. Tek komutla flarum'u basit bir şekilde herkes kurabilir.


#!/bin/bash -
#title :flaruminstall.sh
#description :This script is the updated version of flaruminstall.sh which is originally written by Nartamus.
#author :rawados - nginx@hotmail.com
#date :04/15/20
#version :1.1
#usage :sudo bash flaruminstall.sh
#notes :Tested with Ubuntu 18.04
#==============================================================================

#Change below to what you'd like
MY_DOMAIN_NAME=alanadi.com
MY_EMAIL=mail@gmail.com
DB_NAME=flarumdb
DB_PSWD=flarumpass

SITES_AVAILABLE='/etc/nginx/sites-available/'

clear

echo "***************************************"
echo "* Flarum Installer *"
echo "* Should work on any Ubuntu Distro *"
echo "* By: Nartamus *"
echo "***************************************"

read -p "Are you sure?(y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
sudo apt-get update
sudo apt-get install -y software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository "deb [arch=amd64,arm64,ppc64el] http://mariadb.mirror.liquidtelecom.com/repo/10.4/ubuntu $(lsb_release -cs) main"
sudo apt -y install mariadb-server mariadb-client
sudo apt-get update
sudo add-apt-repository ppa:ondrej/php -y
sudo apt-get install php7.4-fpm php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip -y
sudo apt-get update
sudo apt install zip unzip -y
sudo apt install curl git
sudo curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
sudo apt-get update
sudo mkdir -p /var/www/$MY_DOMAIN_NAME
cd /var/www/$MY_DOMAIN_NAME
composer create-project flarum/flarum . --stability=beta
sudo chown -R www-data:www-data /var/www/$MY_DOMAIN_NAME
sudo chmod -R 755 /var/www/$MY_DOMAIN_NAME
sudo echo " server
{
listen 80;
listen [::]:80;
server_name www.$MY_DOMAIN_NAME;
return 301 http://$MY_DOMAIN_NAME$request_uri;
}
server
{
listen 80;
listen [::]:80;
root /var/www/$MY_DOMAIN_NAME/public;
index index.php index.html index.htm;
server_name $MY_DOMAIN_NAME;
location ~ \.php$
{
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~ /\.
{
deny all;
}
location = /favicon.ico
{
log_not_found off;
access_log off;
}
location = /robots.txt
{
log_not_found off;
access_log off;
allow all;
}
include /var/www/$MY_DOMAIN_NAME/.nginx.conf;
} " > $SITES_AVAILABLE$MY_DOMAIN_NAME.conf
ln -s /etc/nginx/sites-available/$MY_DOMAIN_NAME.conf /etc/nginx/sites-enabled/
sudo mysql -uroot -p$DB_PSWD -e "CREATE DATABASE $DB_NAME"
sudo mysql -uroot -p$DB_PSWD -e "GRANT ALL PRIVILEGES ON $DB_NAME.* TO 'root'@'localhost' IDENTIFIED BY '$DB_PSWD'"
sudo service nginx reload
systemctl restart php7.4-fpm.service
systemctl restart mysql
else
clear
fi