Skip to content

Instantly share code, notes, and snippets.

@charlesthk
Last active June 29, 2021 16:54
Show Gist options
  • Save charlesthk/61bf1caa0119cba7ba8601da0b051e81 to your computer and use it in GitHub Desktop.
Save charlesthk/61bf1caa0119cba7ba8601da0b051e81 to your computer and use it in GitHub Desktop.
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;
}
}
@stealthman22
Copy link

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!!

@stealthman22
Copy link

Could website's root folder be something like this: /var/www/html/wordpress

@charlesthk
Copy link
Author

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