Update Section_06/main.sh, Section_06/php.sh, Section_06/index.php, Section_06/default
This commit is contained in:
parent
144b41bb1f
commit
1371cf1849
91
Section_06/default
Normal file
91
Section_06/default
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
##
|
||||||
|
# You should look at the following URL's in order to grasp a solid understanding
|
||||||
|
# of Nginx configuration files in order to fully unleash the power of Nginx.
|
||||||
|
# https://www.nginx.com/resources/wiki/start/
|
||||||
|
# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
|
||||||
|
# https://wiki.debian.org/Nginx/DirectoryStructure
|
||||||
|
#
|
||||||
|
# In most cases, administrators will remove this file from sites-enabled/ and
|
||||||
|
# leave it as reference inside of sites-available where it will continue to be
|
||||||
|
# updated by the nginx packaging team.
|
||||||
|
#
|
||||||
|
# This file will automatically load configuration files provided by other
|
||||||
|
# applications, such as Drupal or Wordpress. These applications will be made
|
||||||
|
# available underneath a path with that package name, such as /drupal8.
|
||||||
|
#
|
||||||
|
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
|
||||||
|
##
|
||||||
|
|
||||||
|
# Default server configuration
|
||||||
|
#
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
listen [::]:80 default_server;
|
||||||
|
|
||||||
|
# SSL configuration
|
||||||
|
#
|
||||||
|
# listen 443 ssl default_server;
|
||||||
|
# listen [::]:443 ssl default_server;
|
||||||
|
#
|
||||||
|
# Note: You should disable gzip for SSL traffic.
|
||||||
|
# See: https://bugs.debian.org/773332
|
||||||
|
#
|
||||||
|
# Read up on ssl_ciphers to ensure a secure configuration.
|
||||||
|
# See: https://bugs.debian.org/765782
|
||||||
|
#
|
||||||
|
# Self signed certs generated by the ssl-cert package
|
||||||
|
# Don't use them in a production server!
|
||||||
|
#
|
||||||
|
# include snippets/snakeoil.conf;
|
||||||
|
|
||||||
|
root /var/www/html;
|
||||||
|
|
||||||
|
# Add index.php to the list if you are using PHP
|
||||||
|
index index.php index.nginx-debian.html;
|
||||||
|
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# First attempt to serve request as file, then
|
||||||
|
# as directory, then fall back to displaying a 404.
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
# pass PHP scripts to FastCGI server
|
||||||
|
|
||||||
|
location ~ \.php$ {
|
||||||
|
include snippets/fastcgi-php.conf;
|
||||||
|
|
||||||
|
# With php-fpm (or other unix sockets):
|
||||||
|
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
|
||||||
|
# With php-cgi (or other tcp sockets):
|
||||||
|
# fastcgi_pass 127.0.0.1:9000;
|
||||||
|
}
|
||||||
|
|
||||||
|
# deny access to .htaccess files, if Apache's document root
|
||||||
|
# concurs with nginx's one
|
||||||
|
#
|
||||||
|
location ~ /\.ht {
|
||||||
|
deny all;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Virtual Host configuration for example.com
|
||||||
|
#
|
||||||
|
# You can move that to a different file under sites-available/ and symlink that
|
||||||
|
# to sites-enabled/ to enable it.
|
||||||
|
#
|
||||||
|
#server {
|
||||||
|
# listen 80;
|
||||||
|
# listen [::]:80;
|
||||||
|
#
|
||||||
|
# server_name example.com;
|
||||||
|
#
|
||||||
|
# root /var/www/example.com;
|
||||||
|
# index index.html;
|
||||||
|
#
|
||||||
|
# location / {
|
||||||
|
# try_files $uri $uri/ =404;
|
||||||
|
# }
|
||||||
|
#}
|
3
Section_06/index.php
Normal file
3
Section_06/index.php
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
phpinfo();
|
||||||
|
?>
|
31
Section_06/main.sh
Normal file
31
Section_06/main.sh
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Install Apache2
|
||||||
|
sudo apt install apache2
|
||||||
|
sudo systemctl enable apache2 --now
|
||||||
|
cd /etc/apache2/sites-available/
|
||||||
|
cat 000-default.conf
|
||||||
|
ls ../sites-enabled/
|
||||||
|
cat /var/www/html/index.html
|
||||||
|
# sudo apache2ctl -t
|
||||||
|
# sudo a2dissite 000-default
|
||||||
|
# sudo a2ensite 000-default
|
||||||
|
# sudo systemctl reload apache2
|
||||||
|
# sudo systemctl stop apache2
|
||||||
|
# sudo systemctl disable apache2
|
||||||
|
|
||||||
|
# Install Nginx
|
||||||
|
sudo apt install nginx
|
||||||
|
sudo systemctl enable nginx --now
|
||||||
|
cd /etc/nginx/sites-available/
|
||||||
|
cat default
|
||||||
|
ls ../sites-enabled/
|
||||||
|
ls /var/www/html/
|
||||||
|
cat /var/www/html/index.nginx-debian.html
|
||||||
|
sudo nano default
|
||||||
|
sudo rm ../sites-enabled/default
|
||||||
|
sudo ln default ../sites-enabled/
|
||||||
|
sudo systemctl reload nginx
|
||||||
|
# sudo nginx -t
|
||||||
|
# sudo systemctl stop nginx
|
||||||
|
# sudo systemctl disable nginx
|
47
Section_06/php.sh
Normal file
47
Section_06/php.sh
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
PHP_VER=8.1
|
||||||
|
|
||||||
|
# Install PHP modules for Apache2
|
||||||
|
sudo su
|
||||||
|
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
|
||||||
|
echo "deb https://packages.sury.org/php/ bookworm main" > /etc/apt/sources.list.d/php.list
|
||||||
|
apt update
|
||||||
|
apt install libapache2-mod-php${PHP_VER}
|
||||||
|
apt install php${PHP_VER} php${PHP_VER}-cli php${PHP_VER}-common php${PHP_VER}-curl php${PHP_VER}-mbstring php${PHP_VER}-mysql php${PHP_VER}-xml php${PHP_VER}-fileinfo php${PHP_VER}-xml php${PHP_VER}-mbstring php${PHP_VER}-pdo php${PHP_VER}-zip php${PHP_VER}-http php${PHP_VER}-cli
|
||||||
|
phpenmod ctype curl dom iconv mbstring posix simplexml xml zip fileinfo pdo_mysql
|
||||||
|
sudo systemctl enable apache2 --now
|
||||||
|
sudo systemctl restart apache2
|
||||||
|
|
||||||
|
# Testing
|
||||||
|
sudo rm -rf /var/www/html/*
|
||||||
|
sudo nano /var/www/html/index.php
|
||||||
|
sudo nano /etc/php/8.1/apache2/php.ini
|
||||||
|
sudo systemctl restart apache2
|
||||||
|
# sudo systemctl stop apache2
|
||||||
|
# sudo systemctl disable apache2
|
||||||
|
|
||||||
|
# Install Nginx
|
||||||
|
sudo su
|
||||||
|
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
|
||||||
|
echo "deb https://packages.sury.org/php/ bookworm main" > /etc/apt/sources.list.d/php.list
|
||||||
|
apt update
|
||||||
|
apt install php${PHP_VER}-fpm
|
||||||
|
apt install php${PHP_VER}-curl php${PHP_VER}-mbstring php${PHP_VER}-mysql php${PHP_VER}-xml php${PHP_VER}-fileinfo php${PHP_VER}-xml php${PHP_VER}-mbstring php${PHP_VER}-pdo php${PHP_VER}-zip php${PHP_VER}-http php${PHP_VER}-cli
|
||||||
|
phpenmod ctype curl dom iconv mbstring posix simplexml xml zip fileinfo pdo_mysql
|
||||||
|
sudo systemctl enable nginx --now
|
||||||
|
sudo systemctl enable php${PHP_VER}-fpm --now
|
||||||
|
sudo systemctl restart php${PHP_VER}-fpm
|
||||||
|
cd /etc/nginx/sites-available/
|
||||||
|
sudo nano default
|
||||||
|
sudo rm ../sites-enabled/default
|
||||||
|
sudo ln default ../sites-enabled/
|
||||||
|
sudo systemctl reload nginx
|
||||||
|
|
||||||
|
# Testing
|
||||||
|
sudo rm -rf /var/www/html/*
|
||||||
|
sudo nano /var/www/html/index.php
|
||||||
|
sudo nano /etc/php/8.1/fpm/php.ini
|
||||||
|
sudo systemctl restart php${PHP_VER}-fpm
|
||||||
|
# sudo systemctl stop nginx
|
||||||
|
# sudo systemctl disable nginx
|
Loading…
x
Reference in New Issue
Block a user