Skip to content

Commit 0dbc189

Browse files
committed
PHP 7.4 Update & Ubunthu 20 Support
PHP 7.4 Update Ubunthu 20 Support
1 parent f72ff65 commit 0dbc189

File tree

6 files changed

+102
-103
lines changed

6 files changed

+102
-103
lines changed

kloudboy/general.conf

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,31 @@
11
# favicon.ico
22
location = /favicon.ico {
3-
log_not_found off;
4-
access_log off;
3+
log_not_found off;
4+
access_log off;
55
}
66

77
# robots.txt
88
location = /robots.txt {
9-
log_not_found off;
10-
access_log off;
9+
log_not_found off;
10+
access_log off;
1111
}
1212

1313
# assets, media
1414
location ~* \.(?:css(\.map)?|js(\.map)?|jpe?g|png|gif|ico|cur|heic|webp|tiff?|mp3|m4a|aac|ogg|midi?|wav|mp4|mov|webm|mpe?g|avi|ogv|flv|wmv)$ {
15-
expires 7d;
16-
access_log off;
15+
expires 7d;
16+
access_log off;
1717
}
1818

1919
# svg, fonts
2020
location ~* \.(?:svgz?|ttf|ttc|otf|eot|woff2?)$ {
21-
add_header Access-Control-Allow-Origin "*";
22-
expires 7d;
23-
access_log off;
21+
add_header Access-Control-Allow-Origin "*";
22+
expires 7d;
23+
access_log off;
2424
}
2525

2626
# gzip
27-
gzip on;
28-
gzip_vary on;
29-
gzip_proxied any;
27+
gzip on;
28+
gzip_vary on;
29+
gzip_proxied any;
3030
gzip_comp_level 6;
31-
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
32-
33-
# brotli
34-
# brotli on;
35-
# brotli_comp_level 6;
36-
# brotli_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;
31+
gzip_types text/plain text/css text/xml application/json application/javascript application/rss+xml application/atom+xml image/svg+xml;

kloudboy/php_fastcgi.conf

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# 404
2-
try_files $fastcgi_script_name =404;
2+
try_files $fastcgi_script_name =404;
33

44
# default fastcgi_params
5-
include fastcgi_params;
5+
include fastcgi_params;
66

77
# fastcgi settings
8-
fastcgi_pass unix:/var/run/php/php7.3-fpm.sock;
9-
fastcgi_index index.php;
10-
fastcgi_buffers 8 16k;
11-
fastcgi_buffer_size 32k;
8+
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
9+
fastcgi_index index.php;
10+
fastcgi_buffers 8 16k;
11+
fastcgi_buffer_size 32k;
1212

1313
# fastcgi params
14-
fastcgi_param DOCUMENT_ROOT $realpath_root;
15-
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
16-
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$base/:/usr/lib/php/:/tmp/";
14+
fastcgi_param DOCUMENT_ROOT $realpath_root;
15+
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
16+
fastcgi_param PHP_ADMIN_VALUE "open_basedir=$base/:/usr/lib/php/:/tmp/";

kloudboy/security.conf

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# security headers
2-
add_header X-Frame-Options "SAMEORIGIN" always;
3-
add_header X-XSS-Protection "1; mode=block" always;
4-
add_header X-Content-Type-Options "nosniff" always;
5-
add_header Referrer-Policy "no-referrer-when-downgrade" always;
6-
add_header Content-Security-Policy "default-src * data: 'unsafe-eval' 'unsafe-inline'" always;
2+
add_header X-Frame-Options "SAMEORIGIN" always;
3+
add_header X-XSS-Protection "1; mode=block" always;
4+
add_header X-Content-Type-Options "nosniff" always;
5+
add_header Referrer-Policy "no-referrer-when-downgrade" always;
6+
add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
77
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
88

99
# . files
1010
location ~ /\.(?!well-known) {
11-
deny all;
12-
}
11+
deny all;
12+
}

kloudboy/wordpress.conf

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,32 @@
11
# WordPress: allow TinyMCE
22
location = /wp-includes/js/tinymce/wp-tinymce.php {
3-
include kloudboy/php_fastcgi.conf;
3+
include nginxconfig.io/php_fastcgi.conf;
44
}
55

66
# WordPress: deny wp-content, wp-includes php files
77
location ~* ^/(?:wp-content|wp-includes)/.*\.php$ {
8-
deny all;
8+
deny all;
99
}
1010

1111
# WordPress: deny wp-content/uploads nasty stuff
1212
location ~* ^/wp-content/uploads/.*\.(?:s?html?|php|js|swf)$ {
13-
deny all;
13+
deny all;
1414
}
1515

16+
# WordPress: SEO plugin
17+
location ~* ^/wp-content/plugins/wordpress-seo(?:-premium)?/css/main-sitemap\.xsl$ {}
18+
1619
# WordPress: deny wp-content/plugins (except earlier rules)
1720
location ~ ^/wp-content/plugins {
18-
deny all;
21+
deny all;
1922
}
2023

2124
# WordPress: deny scripts and styles concat
2225
location ~* \/wp-admin\/load-(?:scripts|styles)\.php {
23-
deny all;
26+
deny all;
2427
}
2528

2629
# WordPress: deny general stuff
2730
location ~* ^/(?:xmlrpc\.php|wp-links-opml\.php|wp-config\.php|wp-config-sample\.php|wp-comments-post\.php|readme\.html|license\.txt)$ {
28-
deny all;
29-
}
31+
deny all;
32+
}

nginx.conf

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
1-
user www-data;
2-
pid /run/nginx.pid;
3-
worker_processes auto;
1+
user www-data;
2+
pid /run/nginx.pid;
3+
worker_processes auto;
44
worker_rlimit_nofile 65535;
55

66
events {
7-
multi_accept on;
8-
worker_connections 65535;
7+
multi_accept on;
8+
worker_connections 65535;
99
}
1010

1111
http {
12-
charset utf-8;
13-
sendfile on;
14-
tcp_nopush on;
15-
tcp_nodelay on;
16-
server_tokens off;
17-
log_not_found off;
18-
types_hash_max_size 2048;
19-
client_max_body_size 100M;
20-
21-
# MIME
22-
include mime.types;
23-
default_type application/octet-stream;
24-
25-
# logging
26-
access_log /var/log/nginx/access.log;
27-
error_log /var/log/nginx/error.log warn;
28-
29-
# SSL
30-
ssl_session_timeout 1d;
31-
ssl_session_cache shared:SSL:10m;
32-
ssl_session_tickets off;
33-
34-
# Diffie-Hellman parameter for DHE ciphersuites
35-
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
36-
37-
# Mozilla Intermediate configuration
38-
ssl_protocols TLSv1.2 TLSv1.3;
39-
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
40-
41-
# OCSP Stapling
42-
ssl_stapling on;
43-
ssl_stapling_verify on;
44-
resolver 1.1.1.1 1.0.0.1 8.8.8.8 8.8.4.4 208.67.222.222 208.67.220.220 valid=60s;
45-
resolver_timeout 2s;
46-
47-
# load configs
48-
include /etc/nginx/conf.d/*.conf;
49-
include /etc/nginx/sites-enabled/*;
50-
}
12+
charset utf-8;
13+
sendfile on;
14+
tcp_nopush on;
15+
tcp_nodelay on;
16+
server_tokens off;
17+
log_not_found off;
18+
types_hash_max_size 2048;
19+
client_max_body_size 100M;
20+
21+
# MIME
22+
include mime.types;
23+
default_type application/octet-stream;
24+
25+
# Logging
26+
access_log /var/log/nginx/access.log;
27+
error_log /var/log/nginx/error.log warn;
28+
29+
# SSL
30+
ssl_session_timeout 1d;
31+
ssl_session_cache shared:SSL:10m;
32+
ssl_session_tickets off;
33+
34+
# Diffie-Hellman parameter for DHE ciphersuites
35+
ssl_dhparam /etc/nginx/dhparam.pem;
36+
37+
# Mozilla Intermediate configuration
38+
ssl_protocols TLSv1.2 TLSv1.3;
39+
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
40+
41+
# OCSP Stapling
42+
ssl_stapling on;
43+
ssl_stapling_verify on;
44+
resolver 1.1.1.1 1.0.0.1 [2606:4700:4700::1111] [2606:4700:4700::1001] 8.8.8.8 8.8.4.4 [2001:4860:4860::8888] [2001:4860:4860::8844] 208.67.222.222 208.67.220.220 [2620:119:35::35] [2620:119:53::53] valid=60s;
45+
resolver_timeout 2s;
46+
47+
# Load configs
48+
include /etc/nginx/conf.d/*.conf;
49+
include /etc/nginx/sites-enabled/*;
50+
}

wp-install.sh

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22
# GET ALL USER INPUT
3-
tput setaf 2; echo "Domain Name (eg. example.com)?"
3+
tput setaf 2; echo "Domain Name (eg. yoursitename.com)?"
44
read DOMAIN
55
tput setaf 2; echo "Username (eg. database name)?"
66
read USERNAME
@@ -42,46 +42,47 @@ sudo wget -qO nginx.conf https://raw.githubusercontent.com/bajpangosh/High-Traff
4242
sudo mkdir -p /var/www/"$DOMAIN"/public
4343
cd /var/www/"$DOMAIN/public"
4444
cd ~
45-
45+
tput setaf 2; echo "Installing WP-CLI...."
46+
sleep 2;
47+
tput sgr0
48+
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
49+
chmod +x wp-cli.phar
50+
sudo mv wp-cli.phar /usr/local/bin/wp
4651
tput setaf 2; echo "Downloading Latest Wordpress...."
4752
sleep 2;
4853
tput sgr0
4954
sudo wget -q wordpress.org/latest.zip
5055
sudo unzip latest.zip
5156
sudo mv wordpress/* /var/www/"$DOMAIN"/public/
5257
sudo rm -rf wordpress latest.zip
53-
5458
tput setaf 2; echo "Nginx server installation completed.."
5559
sleep 2;
5660
tput sgr0
5761
cd ~
5862
sudo chown www-data:www-data -R /var/www/"$DOMAIN"/public
5963
sudo systemctl restart nginx.service
60-
61-
tput setaf 2; echo "let's install php 7.3 and modules"
64+
tput setaf 2; echo "let's install php 7.4 and modules"
6265
sleep 2;
6366
tput sgr0
64-
sudo apt install php7.3 php7.3-fpm -y
65-
sudo apt-get -y install php7.3-intl php7.3-curl php7.3-gd php7.3-imap php7.3-readline php7.3-common php7.3-recode php7.3-mysql php7.3-cli php7.3-curl php7.3-mbstring php7.3-bcmath php7.3-mysql php7.3-opcache php7.3-zip php7.3-xml php-memcached php-imagick php-memcache memcached graphviz php-pear php-xdebug php-msgpack php7.3-soap
67+
sudo apt install php7.4 php7.4-fpm -y
68+
sudo apt-get -y install php7.4-intl php7.4-curl php7.4-gd php7.4-imap php7.4-readline php7.4-common php7.4-recode php7.4-mysql php7.4-cli php7.4-curl php7.4-mbstring php7.4-bcmath php7.4-mysql php7.4-opcache php7.4-zip php7.4-xml php-memcached php-imagick php-memcache memcached graphviz php-pear php-xdebug php-msgpack php7.4-soap
6669
tput setaf 2; echo "Some php.ini Tweaks"
6770
sleep 2;
6871
tput sgr0
69-
sudo sed -i "s/post_max_size = .*/post_max_size = 2000M/" /etc/php/7.3/fpm/php.ini
70-
sudo sed -i "s/memory_limit = .*/memory_limit = 3000M/" /etc/php/7.3/fpm/php.ini
71-
sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/7.3/fpm/php.ini
72-
sudo sed -i "s/max_execution_time = .*/max_execution_time = 18000/" /etc/php/7.3/fpm/php.ini
73-
sudo sed -i "s/;max_input_vars = .*/max_input_vars = 5000/" /etc/php/7.3/fpm/php.ini
74-
sudo sed -i "s/max_input_time = .*/max_input_time = 1000/" /etc/php/7.3/fpm/php.ini
75-
sudo systemctl restart php7.3-fpm.service
76-
72+
sudo sed -i "s/post_max_size = .*/post_max_size = 2000M/" /etc/php/7.4/fpm/php.ini
73+
sudo sed -i "s/memory_limit = .*/memory_limit = 3000M/" /etc/php/7.4/fpm/php.ini
74+
sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 100M/" /etc/php/7.4/fpm/php.ini
75+
sudo sed -i "s/max_execution_time = .*/max_execution_time = 18000/" /etc/php/7.4/fpm/php.ini
76+
sudo sed -i "s/;max_input_vars = .*/max_input_vars = 5000/" /etc/php/7.4/fpm/php.ini
77+
sudo sed -i "s/max_input_time = .*/max_input_time = 1000/" /etc/php/7.4/fpm/php.ini
78+
sudo systemctl restart php7.4-fpm.service
7779
tput setaf 2; echo "Instaling MariaDB"
7880
sleep 2;
7981
tput sgr0
80-
sudo apt install mariadb-server mariadb-client php7.3-mysql -y
81-
sudo systemctl restart php7.3-fpm.service
82+
sudo apt install mariadb-server mariadb-client php7.4-mysql -y
83+
sudo systemctl restart php7.4-fpm.service
8284
sudo mysql_secure_installation
8385
PASS=`pwgen -s 14 1`
84-
8586
sudo mysql -uroot <<MYSQL_SCRIPT
8687
CREATE DATABASE $USERNAME;
8788
CREATE USER '$USERNAME'@'localhost' IDENTIFIED BY '$PASS';

0 commit comments

Comments
 (0)