Closed cjkoepke closed 6 years ago
@philipnewcomer More information:
2018/08/13 20:50:03 [emerg] 1#1: directive "server_name" is not terminated by ";" in /etc/nginx/conf.d/default.conf:137
nginx: [emerg] directive "server_name" is not terminated by ";" in /etc/nginx/conf.d/default.conf:137
This seems to be the problem as it terminates starting NGINX. Here's my nginx.conf
file:
server {
client_max_body_size 150M;
listen 80;
server_name {{server_name}};
root /var/www/html/sites/{{site_name}}/htdocs;
listen 443 ssl;
ssl on;
ssl_certificate /etc/nginx/https-certificate.cert;
ssl_certificate_key /etc/nginx/https-certificate.key;
{{wp_uploads_proxy_config}}
location / {
index index.php index.html;
try_files $uri $uri/ /index.php?$args;
}
location = /favicon.ico {
access_log off;
log_not_found off;
}
location = /robots.txt {
try_files $uri $uri/ /index.php?$args;
access_log off;
log_not_found off;
}
location ~* \.(css|eot|gif|html|ico|jpe?g|js|mov|mp3|png|svg|ttf|txt|woff)$ {
access_log off;
expires 0;
}
# Rewrite requests to `/wp-.*` on subdirectory installs.
if ( !-e $request_filename ) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^/[_0-9a-zA-Z-]+(/wp-.*) $1 last;
rewrite ^/[_0-9a-zA-Z-]+(/.*\.php)$ $1 last;
}
location ~ \.php$ {
try_files $uri =404;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass {{php_backend}}-$xdebug_suffix;
fastcgi_read_timeout 3600s;
}
}
@cjkoepke I believe you're trying to create a custom Nginx configuration for a specific site (as opposed to modifying the global Nginx configuration), is that correct?
When you have a file named nginx.conf in a local site's directory, it is used as-is, meaning that the placeholders that are present in the template are not interpreted in the override file. So in your case, since {{server_name}}
is replaced with the actual server name when it's present in the template, but it remains as {{server_name}}
in your override file, the configuration is invalid, causing the Nginx error.
So when you want to override the Nginx configuration for a site, you need to copy the generated configuration for that site out of the ~/.pilothouse/_run/nginx-compiled-sites.conf
file, which has the placeholders replaced with real values. (nginx-compiled-sites.conf
will contain the generated configuration of all existing local sites, so make sure you copy only the configuration for the one site you want to override.) Then you can place that generated configuration into nginx.conf
in your local site directory and then modify it to suit.
@philipnewcomer Thank you, I didn't realize it wasn't dynamic.
I can see how it might be useful to be able to use placeholders in the configuration override file, and how it's unintuitive that they can't currently be used there. So I've created an issue (#111) to add this feature.
Hey @philipnewcomer I'm getting the same error Could not get Nginx container internal IP. Skipping adding local site hosts to PHP containers
but I'm not doing any custom configuration, I was working without problems with Pilothouse and after doing a restart the error came out and now Pilothouse starts all the containers and the error appears, you have some idea about this, I would really appreciate your help
@fabolivark the first step would be to check the Nginx container's error logs to see if you can find out more details about the error. Open up Kitematic (it should have been installed along with Docker), find the Nginx container, and check the logs there.
Thanks @philipnewcomer I will review the logs
I need to increase the max file size upload for a site. I updated the
php.ini
file, but when trying to create a local site's customnginx.conf
configuration, I get this error (without any changes, and when copied from the template directory):This happens with no manipulation to the file, and all I'm wanting to add is:
client_max_body_size [X]M;