Welcome! Log In Create A New Profile

Advanced

Nginx / ubuntu (ve) Virtual hosts not working?

Posted by lithium2k 
Nginx / ubuntu (ve) Virtual hosts not working?
September 17, 2012 03:54PM
I have an existing website up on a Nginx/Ubuntu (ve) server. Lets call it domain1.com

I am trying to add a 2nd website to the Nginx server.

There are Nginx configuration files located in:

nginx.conf in /var/
conf in server root
nginx.conf in /opt/nginx/conf
Does anyone know if one of these supersedes the other?

I have edited all the files so that they are the same since I didnt know which to edit. After editing, it looks like the changes only took effect with the config file in /opt/nginx/conf/

The problem is domain2.com is not working. If I visit the URL, it is not being hosted correctly. Sorry I mean the page is not displaying -- index.html does not show. I see the godaddy parked page. Yes, the nameservers are set correctly. I presumed the error was with my Nginx config

Here is the conf file:

#user nobody;
worker_processes 4;
error_log logs/error.log;
#pid logs/nginx.pid;


events {
worker_connections 1024;
}


http {
passenger_root /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/passenger-2.2.15;
passenger_ruby /opt/ruby-enterprise-1.8.7-2010.02/bin/ruby;

include mime.types;
default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log /opt/nginx/logs/access.log main;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;

gzip on;
gzip_http_version 1.1;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain application/pdf video/mp4 video/quicktime text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_buffers 16 8k;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";

server {
listen 80;
server_name www.domain1.com domain1.com;

rewrite ^(.*) https://domain1.com$1 permanent;

}

#*********** ssl server setup ***********
server {
client_max_body_size 500M;
client_body_buffer_size 256k;
listen 443;
server_name www.domain1.com domain1.com;

access_log /var/www/domain1.com/shared/log/access.log;
error_log /var/www/domain1.com/shared/log/error.log;

ssl on;
ssl_certificate /var/shared/public.crt;
ssl_certificate_key /var/shared/domain1.key;
#ssl_session_timeout 5m;
#ssl_protocols SSLv2 SSLv3 TLSv1;
#ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
#ssl_prefer_server_ciphers on;

root /var/www/domain1.com/current/public;
passenger_enabled on;

}

server {
listen 80;
server_name www.domain2.com domain2.com;
rewrite ^/(.*) https://domain2.com/$1 permanent;
}


server {
client_max_body_size 500M;
client_body_buffer_size 256k;
listen 443;
server_name www.domain2.com domain2.com;

#ssl on;
#ssl_certificate /var/shared/domain2.cer;
#ssl_certificate_key /var/shared/server.key;

#ssl_session_timeout 5m;


access_log /var/www/domain2.com/shared/log/access.log;
error_log /var/www/domain2.com/shared/log/error.log;

root /var/www/domain2.com/public;

passenger_enabled on;

location / {
root html;
index index.html index.htm;
}
}


}




Domain1 works well.

Any ideas on domain 2?

edit: I have restarted the Nginx server, no luck.

Thanks
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 325
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready