added nginx conf and vhost generation
This commit is contained in:
parent
62493b59db
commit
5a54256c5a
@ -1,8 +1,10 @@
|
|||||||
server {
|
server {
|
||||||
listen 80 default_server;
|
listen 80 default_server;
|
||||||
root /var/www/html;
|
root /var/www/yourdomain.ltd/public_html;
|
||||||
index index.html index.php;
|
index index.html index.php;
|
||||||
|
|
||||||
|
server_name yourdomain.ltd;
|
||||||
|
|
||||||
charset utf-8;
|
charset utf-8;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
@ -13,7 +15,8 @@ server {
|
|||||||
location = /robots.txt { access_log off; log_not_found off; }
|
location = /robots.txt { access_log off; log_not_found off; }
|
||||||
|
|
||||||
access_log on;
|
access_log on;
|
||||||
error_log /var/log/nginx/error.log error;
|
# error_log /var/log/nginx/error.log error;
|
||||||
|
error_log /var/www/yourdomain.ltd/log/error.log;
|
||||||
|
|
||||||
sendfile off;
|
sendfile off;
|
||||||
|
|
||||||
@ -21,7 +24,7 @@ server {
|
|||||||
|
|
||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
fastcgi_pass php:9000;
|
fastcgi_pass unix:/run/php/php7.0-fpm.sock
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
@ -49,6 +49,7 @@ apt-get --yes --force-yes install vim
|
|||||||
sed -i "s/^# en_GB.UTF-8/en_GB.UTF-8/g" /etc/locale.gen
|
sed -i "s/^# en_GB.UTF-8/en_GB.UTF-8/g" /etc/locale.gen
|
||||||
locale-gen
|
locale-gen
|
||||||
apt-get --yes --force-yes install ntp
|
apt-get --yes --force-yes install ntp
|
||||||
|
dpkg-reconfigure tzdata
|
||||||
|
|
||||||
echo '\033[35m
|
echo '\033[35m
|
||||||
______________ _______ _____ __ __
|
______________ _______ _____ __ __
|
||||||
@ -295,7 +296,6 @@ if [ "$lemp" = "y" ]; then
|
|||||||
systemctl restart mariadb.service
|
systemctl restart mariadb.service
|
||||||
echo "\033[92;1mmysql installed\033[Om"
|
echo "\033[92;1mmysql installed\033[Om"
|
||||||
|
|
||||||
|
|
||||||
echo '\033[35m
|
echo '\033[35m
|
||||||
_ __ _
|
_ __ _
|
||||||
/ | / /___ _(_)___ _ __
|
/ | / /___ _(_)___ _ __
|
||||||
@ -324,6 +324,8 @@ if [ "$lemp" = "y" ]; then
|
|||||||
sleep 3
|
sleep 3
|
||||||
apt-get --yes --force-yes install php7.0-fpm php7.0-mysql php7.0-opcache php7.0-curl php7.0-mbstring php7.0-zip php7.0-xml php7.0-gd php7.0-mcrypt php-memcached
|
apt-get --yes --force-yes install php7.0-fpm php7.0-mysql php7.0-opcache php7.0-curl php7.0-mbstring php7.0-zip php7.0-xml php7.0-gd php7.0-mcrypt php-memcached
|
||||||
|
|
||||||
|
mv /etc/php/7.0/fpm/php.ini /etc/php/7.0/fpm/php.ini.back
|
||||||
|
cp "$_cwd"/assets/php-fpm.ini /etc/php/7.0/fpm/php.ini
|
||||||
|
|
||||||
echo "Configuring PHP"
|
echo "Configuring PHP"
|
||||||
|
|
||||||
@ -331,6 +333,8 @@ if [ "$lemp" = "y" ]; then
|
|||||||
chown www-data /var/log/php
|
chown www-data /var/log/php
|
||||||
cp "$_cwd"/assets/logrotate-php /etc/logrotate.d/php
|
cp "$_cwd"/assets/logrotate-php /etc/logrotate.d/php
|
||||||
|
|
||||||
|
systemctl enable php7.0-fpm
|
||||||
|
systemctl start php7.0-fpm
|
||||||
|
|
||||||
# echo "Installing memecached"
|
# echo "Installing memecached"
|
||||||
# replaced by redis
|
# replaced by redis
|
||||||
@ -381,59 +385,60 @@ if [ "$lemp" = "y" ]; then
|
|||||||
systemctl restart redis-server
|
systemctl restart redis-server
|
||||||
echo "\033[92;1mRedis installed\033[Om"
|
echo "\033[92;1mRedis installed\033[Om"
|
||||||
|
|
||||||
# echo '\033[35m
|
echo '\033[35m
|
||||||
# __ __
|
__ __
|
||||||
# _ __/ /_ ____ _____/ /_
|
_ __/ /_ ____ _____/ /_
|
||||||
# | | / / __ \/ __ \/ ___/ __/
|
| | / / __ \/ __ \/ ___/ __/
|
||||||
# | |/ / / / / /_/ (__ ) /_
|
| |/ / / / / /_/ (__ ) /_
|
||||||
# |___/_/ /_/\____/____/\__/
|
|___/_/ /_/\____/____/\__/
|
||||||
# \033[0m'
|
\033[0m'
|
||||||
# echo "\033[35;1mVHOST install \033[0m"
|
echo "\033[35;1mVHOST install \033[0m"
|
||||||
# while [ "$vh" != "y" ] && [ "$vh" != "n" ]
|
while [ "$vh" != "y" ] && [ "$vh" != "n" ]
|
||||||
# do
|
do
|
||||||
# echo -n "Should we install a vhost? [y|n] "
|
echo -n "Should we install a vhost? [y|n] "
|
||||||
# read vh
|
read vh
|
||||||
# # vh=${vh:-y}
|
# vh=${vh:-y}
|
||||||
# done
|
done
|
||||||
# if [ "$vh" = "y" ]; then
|
if [ "$vh" = "y" ]; then
|
||||||
#
|
|
||||||
# while [ "$_host_name" = "" ]
|
while [ "$_host_name" = "" ]
|
||||||
# do
|
do
|
||||||
# read -p "enter a hostname ? " _host_name
|
read -p "enter a hostname ? " _host_name
|
||||||
# if [ "$_host_name" != "" ]; then
|
if [ "$_host_name" != "" ]; then
|
||||||
# read -p "is hostname $_host_name correcte [y|n] " validated
|
read -p "is hostname $_host_name correcte [y|n] " validated
|
||||||
# if [ "$validated" = "y" ]; then
|
if [ "$validated" = "y" ]; then
|
||||||
# break
|
break
|
||||||
# else
|
else
|
||||||
# _host_name=""
|
_host_name=""
|
||||||
# fi
|
fi
|
||||||
# fi
|
fi
|
||||||
# done
|
done
|
||||||
#
|
|
||||||
# cp "$_cwd"/assets/example.org.conf /etc/apache2/sites-available/"$_host_name".conf
|
cp "$_cwd"/assets/nginx.conf /etc/nginx/sites-available/"$_host_name".conf
|
||||||
# sed -ir "s/example\.org/$_host_name/g" /etc/apache2/sites-available/"$_host_name".conf
|
sed -ir "s/yourdomain\.ltd/$_host_name/g" /etc/nginx/sites-available/"$_host_name".conf
|
||||||
#
|
|
||||||
# mkdir -p /srv/www/"$_host_name"/public_html
|
mkdir -p /var/www/"$_host_name"/public_html
|
||||||
# mkdir /srv/www/"$_host_name"/logs
|
mkdir /srv/www/"$_host_name"/logs
|
||||||
# #set proper right to user will handle the app
|
#set proper right to user will handle the app
|
||||||
# chown -R root:admin /srv/www/"$_host_name"/
|
chown -R root:admin /srv/www/"$_host_name"/
|
||||||
# chmod -R g+w /srv/www/"$_host_name"/
|
chmod -R g+w /srv/www/"$_host_name"/
|
||||||
# chmod -R g+r /srv/www/"$_host_name"/
|
chmod -R g+r /srv/www/"$_host_name"/
|
||||||
#
|
|
||||||
# # create a shortcut to the site
|
# create a shortcut to the site
|
||||||
# mkdir /home/"$user"/www/
|
mkdir /home/"$user"/www/
|
||||||
# chown "$user":admin /home/"$user"/www/
|
chown "$user":admin /home/"$user"/www/
|
||||||
# ln -s /srv/www/"$_host_name" /home/"$user"/www/"$_host_name"
|
ln -s /srv/www/"$_host_name" /home/"$user"/www/"$_host_name"
|
||||||
#
|
|
||||||
# #activate the vhost
|
# activate the vhost
|
||||||
# a2ensite "$_host_name".conf
|
# a2ensite "$_host_name".conf
|
||||||
#
|
ln -s /etc/nginx/sites-available/"$_host_name".conf /etc/nginx/sites-enabled/"$_host_name".conf
|
||||||
# #restart apache
|
|
||||||
# service apache2 restart
|
# restart nginx
|
||||||
# echo "\033[92;1mvhost $_host_name configured\033[Om"
|
systemctl restart nginx
|
||||||
# else
|
echo "\033[92;1mvhost $_host_name configured\033[Om"
|
||||||
# echo "Vhost installation aborted"
|
else
|
||||||
# fi
|
echo "Vhost installation aborted"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# TODO supervising
|
# TODO supervising
|
||||||
|
Loading…
x
Reference in New Issue
Block a user