Last active
June 29, 2021 16:54
-
-
Save charlesthk/61bf1caa0119cba7ba8601da0b051e81 to your computer and use it in GitHub Desktop.
Wordpress Local Nginx Config (https://medium.com/@charlesthk/wordpress-on-os-x-with-nginx-php-mysql-62767a62efc4)
This file contains hidden or 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 { | |
listen 80; | |
# substitute your web server's local URL with yours | |
server_name my-wp-website.localhost; | |
index index.html index.php; | |
client_max_body_size 40M; | |
access_log /usr/local/var/log/nginx/my-wp-website.localhost.access.log; | |
error_log /usr/local/var/log/nginx/my-wp-website.localhost.error.log; | |
# substitute your web server's root folder with yours | |
root /Users/mymacusername/dev/my-wp-website-folder; | |
location ~ \.php$ { | |
try_files $uri =404; | |
fastcgi_index index.php; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_read_timeout 300; | |
fastcgi_keep_conn on; | |
include /usr/local/etc/nginx/fastcgi_params; | |
# Php-fpm is bound to port 9071 | |
fastcgi_pass 127.0.0.1:9071; | |
index index.html index.php; | |
} | |
location / { | |
try_files $uri | |
$uri/ | |
/index.php?$args; | |
} | |
} |
Could website's root folder be something like this: /var/www/html/wordpress
Yes you just have to put the path to your folder
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've been looking for this for almost two days now, all the guides seem to be conflicted when it comes to the point of setting the config file, especially for localhost. Would try this out, thanks anyways it turns out!!