I have a vagrant box that has been working fine for sometime and today for some reason I get the following when I attemp to restart nginx.
nginx: [emerg] host not found in upstream "www.myclass.com.192.168.33.10.xip.io" in /etc/nginx/conf.d/myclass.com.conf:19 nginx: configuration file /etc/nginx/nginx.conf test failed
I've not changed anything myself as far as I know of (unless Windows Update has done something strange)
Can anyone suggest how to get nginx working again & allowing me to restart the nginx service - it would appear I cannot ping the host... any ideas why?
Here is my nginx conf file: nginx conf file
--Update-- Run the following to check what is on port 80.. (having read another similar post) and I can see that the varnish daemon is on port 80.. is this cause of the problem?? Any advice would be welcomed as I'm new to this stuff
sudo netstat -tlnp | grep 80
My myclass.com.conf file
server { listen 80; server_name class.com.* www.class.com.*; root /vagrant/www.class.com/public_html; index index.php; access_log /vagrant/log/class.com.access.log; error_log /vagrant/log/class.com.error.log error; charset utf-8; location = /favicon.ico { log_not_found off; access_log off; } location = /robots.txt { access_log off; log_not_found off; } error_page 404 /index.php; location /socket.io { proxy_pass http://www.class.com.192.168.33.10.xip.io:8055; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_http_version 1.1; } location / { try_files $uri $uri/ @handler; expires 30d; } location /. { return 404; } location @handler { rewrite / /index.php last; } location ~ .php/ { rewrite ^(.*.php)/ $1 last; } location ~ \.php$ { try_files $uri =404; expires off; fastcgi_read_timeout 900; fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param CLASS_ENVIRONMENT LYLE; include /etc/nginx/fastcgi_params; } gzip on; gzip_min_length 1000; gzip_proxied any; gzip_types text/plain application/xml text/css text/js application/x-javascript; sendfile off;
}
upstream defines a cluster that you can proxy requests to. It's commonly used for defining either a web server cluster for load balancing, or an app server cluster for routing / load balancing.
By default, the configuration file is named nginx. conf and placed in the directory /usr/local/nginx/conf , /etc/nginx , or /usr/local/etc/nginx .
All you need is to put resolver that can resolve such domain name:
resolver 8.8.8.8 valid=300s; resolver_timeout 10s;
Google DNS (8.8.8.8) can resolve it, but it resolves to internal address belongs to network class C.
$ dig @8.8.8.8 www.class.com.192.168.33.10.xip.io ;; ANSWER SECTION: www.class.com.192.168.33.10.xip.io. 299 IN A 192.168.33.10
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With