Last active
February 15, 2020 13:38
-
-
Save majeedraza1/1dba60fcad4208da0a323538e4e81f88 to your computer and use it in GitHub Desktop.
Nginx vHost configuration sample for WordPress project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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