Skip to content

Commit f72ff65

Browse files
committed
update
1 parent b69587f commit f72ff65

File tree

2 files changed

+59
-6
lines changed

2 files changed

+59
-6
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
server {
2+
listen 443 ssl http2;
3+
listen [::]:443 ssl http2;
4+
5+
server_name sub.example.com;
6+
set $base /var/www/sub.example.com;
7+
root $base/public;
8+
9+
# SSL
10+
ssl_certificate /etc/nginx/ssl/nginx.crt;
11+
ssl_certificate_key /etc/nginx/ssl/nginx.key;
12+
13+
# security
14+
include kloudboy/security.conf;
15+
16+
# index.php
17+
index index.php;
18+
19+
# index.php fallback
20+
location / {
21+
try_files $uri $uri/ /index.php?$query_string;
22+
}
23+
24+
# handle .php
25+
location ~ \.php$ {
26+
include kloudboy/php_fastcgi.conf;
27+
}
28+
29+
# additional config
30+
include kloudboy/general.conf;
31+
include kloudboy/wordpress.conf;
32+
}
33+
34+
# subdomains redirect
35+
server {
36+
listen 443 ssl http2;
37+
listen [::]:443 ssl http2;
38+
39+
server_name *.sub.example.com;
40+
41+
# SSL
42+
ssl_certificate /etc/nginx/ssl/nginx.crt;
43+
ssl_certificate_key /etc/nginx/ssl/nginx.key;
44+
45+
return 301 https://sub.example.com$request_uri;
46+
}
47+
48+
# HTTP redirect
49+
server {
50+
listen 80;
51+
listen [::]:80;
52+
53+
server_name .sub.example.com;
54+
55+
return 301 https://sub.example.com$request_uri;
56+
}

new-wp-install.sh renamed to sub-domain-install.sh

Lines changed: 3 additions & 6 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. sub.example.com)?"
44
read DOMAIN
55
tput setaf 2; echo "Username (eg. database name)?"
66
read USERNAME
@@ -12,15 +12,12 @@ tput setaf 2; echo "Sit back and relax :) ......"
1212
sleep 1;
1313
tput sgr0
1414
cd /etc/nginx/sites-available/
15-
16-
sudo wget -qO "$DOMAIN" https://raw.githubusercontent.com/bajpangosh/High-Traffic-wordpress-server-configuration/master/sites-available/example.com.conf
17-
sudo sed -i -e "s/example.com/$DOMAIN/" "$DOMAIN"
18-
sudo sed -i -e "s/www.example.com/$DOMAIN/" "$DOMAIN"
15+
sudo wget -qO "$DOMAIN" https://raw.githubusercontent.com/bajpangosh/High-Traffic-wordpress-server-configuration/master/sites-available/sub.example.com.conf
16+
sudo sed -i -e "s/sub.example.com/$DOMAIN/" "$DOMAIN"
1917
sudo ln -s /etc/nginx/sites-available/"$DOMAIN" /etc/nginx/sites-enabled/
2018
sudo mkdir -p /var/www/"$DOMAIN"/public
2119
cd /var/www/"$DOMAIN/public"
2220
cd ~
23-
2421
tput setaf 2; echo "Downloading Latest Wordpress...."
2522
sleep 2;
2623
tput sgr0

0 commit comments

Comments
 (0)