0

I'm currently using using the Homestead Vagrant Box to develop several Wordpress websites on. However there are significant issues with the Vagrant server, as it fails to update my 'style.css' files. Sometimes it loads an old version of the file and sometime the get request returns 'ERR_EMPTY_RESPONSE'. Other files such as 'index.php' load timely and consistently. Restarting nginx fixes the issue from time to time but not always.

Here is a copy of my nginx configs:

# nginx.conf
#
# Customizations should be done in conf.d ideally.

# Run as vagrant rather than the default www-data
user vagrant;

# Default to the number of CPU cores available
worker_processes auto;

# Process identifier
pid /run/nginx.pid;

# Enable just-in-time compilation of regex during config parsing
#pcre_jit on;

events {
# max clients = worker_processes * worker_connections
worker_connections 2000;

# Accept all new connectons on a worker process rather than one at a time
multi_accept on;

# Most efficient connection processing method on linux 2.6+
use epoll;
}

http {

## Define MIME types
include /etc/nginx/mime.types;
default_type application/octet-stream;

# Default error log
error_log /var/log/nginx/error.log;

# Default access log
access_log /var/log/nginx/access.log;
# Default access log
access_log /var/log/nginx/access.log;

# PHP Upstream
upstream php {
    server unix:/var/run/php5-fpm.sock;
}

# HHVM Upstream
upstream hhvm {
    server unix:/var/run/hhvm/hhvm.sock;
}

# Default index pages
index index.html index.php index.hh;

# Turn sendfile off in a virtual machine because of issues
#
# The nginx default for sendfile is on, which appears to not jive with something
# about the VM for some things, causing weird encoding issues in Javascript
# that create syntax errors and weird encoding issues in CSS that make it seem
# like your file has been cached forever. Crazy stuff - so off it is.
#
# See - http://jeremyfelt.com/code/2013/01/08/clear-nginx-cache-in-vagrant/
# From - https://github.com/Varying-Vagrant-Vagrants/VVV
#
# Note that this should most likely be turned on in a production environment
sendfile off;

# Don't send out partial TCP frames
tcp_nopush on;
tcp_nodelay on;

# How long each connection should stay idle
keepalive_timeout 65;

# Reset lingering timed out connections. Deflect DDoS and free memory.
reset_timedout_connection on;

# If a request line or header field does not fit into this buffer, then larger
# buffers via large_client_header_buffers are allocated
client_header_buffer_size 1k;

# The maximum number and size of large headers to accept from a client
large_client_header_buffers 4 8k;

# If the requested body size is more than the buffer size, the entire body is
# written to a temporary file. Default is 8k or 16k depending on the platform.
client_body_buffer_size 16k;

# Max size of a body to allow. Essentially the max upload size
client_max_body_size 16M;

# Accommodate server directives that have hundred(s) of server_names, such as large multisite networks
types_hash_max_size 2048;
server_names_hash_max_size 512;
server_names_hash_bucket_size 512;

# Hide nginx version information
server_tokens off;

# Hide PHP version and other related fastcgi headers
fastcgi_hide_header X-Powered-By;
fastcgi_hide_header X-Pingback;
fastcgi_hide_header Link;
proxy_hide_header X-Powered-By;
proxy_hide_header X-Pingback;
proxy_hide_header X-Link;

# Define a zone for limiting the number of simultaneous connections nginx accepts.
# 1m means 32000 simultaneous sessions. We need to define for each server the limit_conn
# value refering to this or other zones.
limit_conn_zone $binary_remote_addr zone=arbeit_conn:10m;

# Define a zone for limiting the number of simultaneous requests nginx accepts.
# Like the connection zone above.
limit_req_zone $binary_remote_addr zone=arbeit_req:10m rate=250r/m;

# Additional configuration (including gzip and SSL)
include /etc/nginx/conf.d/*.conf;

# Virtual hosts
include /etc/nginx/sites-enabled/*;

ssl.conf:

# Default SSL certificates
ssl_certificate         /etc/nginx/ssl/server.crt;
ssl_certificate_key     /etc/nginx/ssl/server.key;

# Protocols and ciphers based on Cloudflare's sslconfig minus RC4
# See - https://github.com/cloudflare/sslconfig
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5:!RC4;
ssl_prefer_server_ciphers on;

# Use a stronger DHE key of 2048-bits
ssl_dhparam /etc/nginx/ssl/dhparam.pem;

# Disable gzip of dynamic content over SSL/TLS
#gzip off;

# Enable sessions cache
# 1m is equal to about 4000 sessions.
ssl_session_cache   shared:SSL:10m;
ssl_session_timeout 10m;

# Name servers to resolve upstream servers
resolver 8.8.4.4 8.8.8.8 valid=300s;

# Enable spdy
spdy_headers_comp 5;
add_header Alternate-Protocol 443:npn-spdy/3.1;

# Enable Strict Transport Security (HSTS)
#map $scheme $hsts_header {
#    https  max-age=31536000;
#}
#add_header Strict-Transport-Security $hsts_header;

gzip.conf:

# Enable Gzip compression
gzip on;
gzip_static on;
gzip_vary on;

gzip_proxied any;
gzip_http_version 1.1;
gzip_buffers 16 8k;

# Compression level (1-9)
gzip_comp_level 5;

# Don't compress anything under 256 bytes
gzip_min_length 256;

# Compress output of these MIME-types
gzip_types
    application/atom+xml
    application/javascript
    application/json
    application/rss+xml
    application/vnd.ms-fontobject
    application/x-font-ttf
    application/x-javascript
    application/x-web-app-manifest+json
    application/xhtml+xml
    application/xml
    font/opentype
    image/svg+xml
    image/x-icon
    text/css
    text/xml
    text/javascript
    text/plain
    text/x-component;

# Disable gzip for bad browsers
gzip_disable  "MSIE [1-6]\.(?!.*SV1)";

Anyone know what could be wrong/ has any suggestions or answers on why this is happening?

curious-cat
  • 421
  • 1
  • 7
  • 17
  • Please post your site configuraton from `/etc/nginx/conf.d/`, included configuration seems unrelated to problem. – Dmitry Verhoturov Jan 30 '15 at 14:37
  • Still somehow unrelated, you didn't show us locations. By the way I'll suggest to change sockets, `unix:/var/run/some.sock;`, to TCP\IP connections, unix sockets are [not recommended](http://stackoverflow.com/a/10470827/961092) in use with nginx. – Dmitry Verhoturov Jan 30 '15 at 21:07

0 Answers0