Skip to content

Instantly share code, notes, and snippets.

@majeedraza1
Last active February 15, 2020 13:38
Show Gist options
  • Save majeedraza1/1dba60fcad4208da0a323538e4e81f88 to your computer and use it in GitHub Desktop.
Save majeedraza1/1dba60fcad4208da0a323538e4e81f88 to your computer and use it in GitHub Desktop.
Nginx vHost configuration sample for WordPress project
server {
# Point your wordpress project directory. in our case it is (/var/www/wordpress.test)
root /var/www/wordpress.test;
index index.php;
# Give virtual host domain name
server_name wordpress.test www.wordpress.test;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
log_not_found off;
access_log off;
allow all;
}
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.2-fpm.sock; # Make sure to point correct path
fastcgi_index index.php;
client_max_body_size 128m;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_read_timeout 3000;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment