I also ran into a similar issue and the problem was that the location needs to be put before the additional config files are loaded. Here’s what I ended up with:
server {
server_name _;
return 302 $scheme://local.dev$request_uri;
}
server {
server_name ~^(.*)\.local\.dev$ local.dev;
root /app/public/;
index index.php index.html index.htm;
# Directives to send expires headers and turn off 404 error logging.
location ~* \.(js|css|png|svg|jpe?g|gif|ico)$ {
expires 24h;
log_not_found off;
try_files $uri $uri/ @production;
}
location @production {
resolver 8.8.8.8;
proxy_pass http://example.com/$uri;
}
include do-not-modify/*.conf;
}
Another working example. This one rewrites all requests for media in the /uploads/ directory so that they reference the remote site instead.
Edit conf/nginx/site.conf to include match this, swapping out local.dev for your local URL and https://example.com for the URL of the site you want to pull images and other media from:
server {
server_name _;
return 302 $scheme://local.dev$request_uri;
}
server {
server_name ~^(.*)\.local\.dev$ campbells.dev;
root /app/public/;
index index.php index.html index.htm;
# Load media in /uploads/ from remote site.
location ~ ^/wp-content/uploads/(.*) {
rewrite ^/wp-content/uploads/(.*)$ https://example.com/wp-content/uploads/$1 permanent;
}
include do-not-modify/*.conf;
}
Hi, I am new to flywheel. I am moving from vvv (vagrant) since we got wp-frontenders that are struggling with vagrant. So far so good but there is this one thing I cannot figure out: proxy_pass
I can’t seem to find the file site.conf
Anyone can help?
The site config is managed by Local if you are using the “Preferred” Local environment. If you switch to a custom environment, you can edit the config.
From there if you right-click on the site name you can choose “Reveal in Finder” and the site config will be located at conf/nginx/site.conf.