Browse Source

wordpress finished

main
Zenen Treadwell 3 years ago
parent
commit
26ababe764
  1. 8
      resources/wordpress.nginx.conf
  2. 47
      scripts/wordpress.sh

8
resources/wordpress.nginx.conf

@ -1,9 +1,9 @@
server { server {
listen 8000 default_server; listen 80 default_server;
listen [::]:8000 default_server; listen [::]:80 default_server;
server_name 10.0.0.150; server_name SERVER_NAME;
root /home/pi/wordpress; root FILE_ROOT;
index index.php; index index.php;
location = /favicon.ico { location = /favicon.ico {

47
scripts/wordpress.sh

@ -114,7 +114,7 @@ while [[ -z $WP_DIR ]]; do
fi fi
done done
if [[ -z $(ls -A $WP_DIR) ]]; then if [[ -z $(ls -A $WP_DIR/wordpress) ]]; then
tar -xzvf resources/wordpress.tar.gz --directory $WP_DIR tar -xzvf resources/wordpress.tar.gz --directory $WP_DIR
echo "Wordpress has been extracted to $WP_DIR"! echo "Wordpress has been extracted to $WP_DIR"!
else else
@ -137,6 +137,45 @@ echo "Done!"
# ------------------- Step 3 - NGINX Setup ------------------- # ------------------- Step 3 - NGINX Setup -------------------
echo "" echo ""
sudo cp resources/wordpress.nginx.conf /etc/nginx/sites-available/wp echo "We might need to query DNS records here..."
install_if_needed dig
# Deleting location block echo ""
read -p "Do you have a domain name pointing to this computer? (y/n): " -n1 boot
echo ""
case $boot in
y | Y)
echo "Good to hear! What is it?"
read -p "http://" domain
;;
*)
echo "Okay, let's just configure it to your external IP for now."
domain=$(dig @resolver4.opendns.com myip.opendns.com +short)
echo "Looks like you're running on ${domain}"
;;
esac
echo ""
WP_NGINX_CONF=/etc/nginx/sites-available/wp
sudo cp resources/wordpress.nginx.conf $WP_NGINX_CONF
sudo sed -i "s#SERVER_NAME#${domain}#" $WP_NGINX_CONF
sudo sed -i "s#FILE_ROOT#${WP_DIR}/wordpress#" $WP_NGINX_CONF
sudo ln -s /etc/nginx/sites-available/wp /etc/nginx/sites-enabled/
echo ""
sudo systemctl reload nginx
echo "Excellent! We've configured $WP_NGINX_CONF to serve your WordPress site from $domain"
echo ""
# ------------------- Step 4 - Certbot -------------------
read -p "Would you like to enable SSL via Certbot? (y/n): " -n1 boot
echo ""
case $boot in
y | Y)
echo "Alright, let's get Certbot in here!"
install_if_needed python3 certbot python3-certbot-nginx
echo "${BOLD}Take it away, Certbot${NC}"
sudo certbot --nginx
;;
*)
echo "Yea, SSL is lame anyways..."
;;
esac
echo ""
echo "Okay, well that's everything! You should be ready to continue your WordPress setup by opening $domain in your browser."

Loading…
Cancel
Save