Skip to content

Instantly share code, notes, and snippets.

@serverok
Last active July 9, 2024 17:52
Show Gist options
  • Save serverok/36c9e107359763a54eb247a7358dfc3e to your computer and use it in GitHub Desktop.
Save serverok/36c9e107359763a54eb247a7358dfc3e to your computer and use it in GitHub Desktop.
wordpress install
Reaplce YOUR-DOMAIN.EXT with you actual domain or subdomain. Point domain to server IP by editing DNS.
To create a new wordpress site, create a dirctory
/var/www/YOUR-DOMAIN.EXT/public_html
Upload wordpress files inside.
Create nginx config
/etc/nginx/sites-enabled/YOUR-DOMAIN.EXT
Add following content inside the file.
server {
listen 80;
server_name YOUR-DOMAIN.EXT www.YOUR-DOMAIN.EXT;
root /var/www/YOUR-DOMAIN.EXT/public_html;
index index.php index.html index.htm;
location /{
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm-ralus.sock;
}
location ~ /\.ht {
deny all;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
error_log /var/log/nginx/YOUR-DOMAIN.EXT-error.log;
access_log /var/log/nginx/YOUR-DOMAIN.EXT-access.log;
}
Restart nginx
systemctl restart nginx
To enable SSL, run
certbot --authenticator webroot --webroot-path /var/www/YOUR-DOMAIN.EXT/public_html --installer nginx --agree-tos --no-eff-email --email admin@YOUR-DOMAIN.EXT -d YOUR-DOMAIN.EXT -d www.YOUR-DOMAIN.EXT
Now visit you website, you will get wordpress install page. It will ask for a database name, username and password.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment