1
0
mirror of https://github.com/tommytran732/Linux-Setup-Scripts synced 2024-11-23 09:51:32 -05:00

Compare commits

..

No commits in common. "8febd18b4eae8bba022377dee29615fbf82dd9a5" and "fa62d9021b683c2c0d4c77d773a932f610db9bc1" have entirely different histories.

3 changed files with 8 additions and 23 deletions

View File

@ -14,7 +14,7 @@ sudo dnf install -y composer
## Install other necessary packages ## Install other necessary packages
``` ```
sudo dnf install -y php-gd php-mysqlnd php-opcache php-pdo unzip sudo dnf install -y php-gd php-pdo unzip
``` ```
## Setup Directory Structure ## Setup Directory Structure
@ -34,8 +34,6 @@ sudo setfacl -m u:nginx:rwx /srv/drupal
# Setup SELinux context # Setup SELinux context
sudo semanage fcontext -a -t httpd_sys_content_t "$(realpath /srv/drupal)(/.*)?" sudo semanage fcontext -a -t httpd_sys_content_t "$(realpath /srv/drupal)(/.*)?"
sudo semanage fcontext -a -t httpd_sys_rw_content_t "$(realpath /srv/drupal)(/.*)/web/sites(/.*)/files(/.*)?"
sudo semanage fcontext -a -t httpd_sys_rw_content_t "$(realpath /srv/drupal)(/.*)/web/sites(/.*)/settings.php"
sudo restorecon -Rv /srv/drupal sudo restorecon -Rv /srv/drupal
``` ```
@ -55,7 +53,7 @@ umask 022
cd /srv/drupal cd /srv/drupal
composer create-project drupal/recommended-project drupal.yourdomain.tld composer create-project drupal/recommended-project drupal.yourdomain.tld
cp /srv/drupal/drupal.yourdomain.tld/web/sites/default/default.settings.php /srv/drupal/drupal.yourdomain.tld/web/sites/default/settings.php cp /srv/drupal/drupal.yourdomain.tld/web/sites/default/default.settings.php /srv/drupal/drupal.yourdomain.tld./web/sites/default/settings.php
``` ```
Exit the drupal user: Exit the drupal user:
@ -63,12 +61,6 @@ Exit the drupal user:
exit exit
``` ```
Fix the labels (why mkdir is giving us the wrong label idk, need more investigation):
```
sudo restorecon -Rv /srv/drupal
```
## Generate an SSL certificate ## Generate an SSL certificate
``` ```
@ -102,7 +94,7 @@ server {
include snippets/cross-origin-security.conf; include snippets/cross-origin-security.conf;
include snippets/quic.conf; include snippets/quic.conf;
add_header Content-Security-Policy "default-src 'none'; connect-src 'self'; font-src 'self'; img-src 'self' data:; script-src 'self'; style-src 'self' 'unsafe-inline'; base-uri 'none'; block-all-mixed-content; form-action 'self'; frame-ancestors 'self'; upgrade-insecure-requests"; add_header Content-Security-Policy "default-src 'none'; connect-src 'self'; font-src 'self'; img-src 'self' data:; script-src 'self'; style-src 'self' 'unsafe-inline'; base-uri 'none'; block-all-mixed-content; form-action 'none'; frame-ancestors 'self'; upgrade-insecure-requests";
index index.php; index index.php;
root /srv/drupal/drupal.yourdomain.tld/web; root /srv/drupal/drupal.yourdomain.tld/web;
@ -131,9 +123,9 @@ mariadb -uroot
Run the following queries: Run the following queries:
``` ```
CREATE DATABASE drupal_default CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE DATABASE drupal CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'drupal_default'@'127.0.0.1' IDENTIFIED BY 'yourPassword'; CREATE USER 'drupal'@'127.0.0.1' IDENTIFIED BY 'yourPassword';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES ON drupal_default.* TO 'drupal_default'@'127.0.0.1'; GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES ON drupal.* TO 'drupal'@'127.0.0.1';
exit exit
``` ```

View File

@ -47,13 +47,6 @@ sudo systemctl enable --now php-fpm
# Install MariaDB # Install MariaDB
unpriv curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash unpriv curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash
sudo dnf install -y MariaDB-server sudo dnf install -y MariaDB-server
sudo systemctl enable --now mariadb
# Secure MariaDB
output "Running mariadb-secure-installation."
output "You should answer yes to everything except setting the root password."
output "This is already done via the UNIX socket if you switch it with the prompts so you should be okay."
sudo mariadb-secure-installation
# Run NGINX Setup script # Run NGINX Setup script
unpriv curl -LsS https://raw.githubusercontent.com/TommyTran732/NGINX-Configs/main/setup.sh | sudo bash unpriv curl -LsS https://raw.githubusercontent.com/TommyTran732/NGINX-Configs/main/setup.sh | sudo bash
@ -62,4 +55,4 @@ unpriv curl -LsS https://raw.githubusercontent.com/TommyTran732/NGINX-Configs/ma
sudo sed -i 's/user = apache/user = nginx/g' /etc/php-fpm.d/www.conf sudo sed -i 's/user = apache/user = nginx/g' /etc/php-fpm.d/www.conf
sudo sed -i 's/group = apache/group = nginx/g' /etc/php-fpm.d/www.conf sudo sed -i 's/group = apache/group = nginx/g' /etc/php-fpm.d/www.conf
sudo chgrp nginx /var/lib/php/opcache /var/lib/php/session /var/lib/php/wsdlcache sudo chgrp nginx /var/lib/php/opcache /var/lib/php/session /var/lib/php/wsdlcache
sudo systemctl restart php-fpm sudo systemctl restart php-fpm

View File

@ -93,7 +93,7 @@ server {
include snippets/cross-origin-security.conf; include snippets/cross-origin-security.conf;
include snippets/quic.conf; include snippets/quic.conf;
add_header Content-Security-Policy "default-src 'none'; connect-src 'self'; font-src 'self'; img-src 'self' data:; script-src 'self'; style-src 'self' 'unsafe-inline'; base-uri 'none'; block-all-mixed-content; form-action 'self'; frame-ancestors 'self'; upgrade-insecure-requests"; add_header Content-Security-Policy "default-src 'none'; connect-src 'self'; font-src 'self'; img-src 'self' data:; script-src 'self'; style-src 'self' 'unsafe-inline'; base-uri 'none'; block-all-mixed-content; form-action 'none'; frame-ancestors 'self'; upgrade-insecure-requests";
index index.php; index index.php;
root /srv/drupal/drupal.yourdomain.tld/web; root /srv/drupal/drupal.yourdomain.tld/web;