php - NGINX Mulitple Site Config One IP -
okay have virtual machine company uses web server. internal php application on , needing add site server. problem vm on has 1 ip. have windows dns manger set point ip pull main site. there way configure nginx pick site pull up?
here first site config:
server { server_name develop.aspirion.com; root /var/www/vhosts/develop.aspirion.com; index index.html; location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass unix:/var/run/php5-fpm/php5-fpm.sock; fastcgi_index index.php; include fastcgi_params; } } here second site config:
server { server_name aspirion.com; access_log /var/log/nginx/aspirion.com-access.log; error_log /var/log/nginx/aspirion.com-error.log; root /var/virtual/aspirion.com/master/current/webroot; index index.php; location / { # error_page 404 /index.php; location = / { error_page 404 =200 /index.html; } location ~* ^.+\.(?:css|js|jpe?g|gif|htc|ico|png|html|xml)$ { access_log off; expires 30d; tcp_nodelay off; open_file_cache max=3000 inactive=120s; open_file_cache_valid 45s; open_file_cache_min_uses 2; open_file_cache_errors off; } location ~* ^.+\.(?:pdf|pptx?)$ { expires 30d; tcp_nodelay off; } # todo: never allow private files inside web root? location ^~ /sites/default/files/private/ { internal; } location ~* ^(?:.+\.(?:htaccess|make|txt|engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(?:\.php)?|xtmpl)|code-style\.pl|/entries.*|/repository|/root|/tag|/template)$ { return 404; } try_files $uri $uri/ /index.php?$uri&$args; } location = /index.php { fastcgi_pass phpcgi; } location = /.git { return 404; } location = /patches { return 404; } location = /backup { return 404; } location = /robots.txt { access_log off; } location = /humans.txt { access_log off; try_files $uri $uri/ /index.php?$uri&$args; } location = /rss.xml { try_files $uri $uri/ /index.php?$uri&$args; } location = /sitemap.xml { try_files $uri $uri/ /index.php?$uri&$args; } location = /favicon.ico { try_files /favicon.ico =204; } location ~* ^.+\.php$ { return 404; } } server { server_name munin.aspirion.com; include sites-available/admin.conf; }
yes, normal nginx serve several domains single ip address.
browsers resolve dns both domains same ip, , forward traffic port 80 on ip address. nginx listening there , checks incoming host: header , matches against server_name values in configuration. problem not related having 2 domains on 1 ip address. try things:
- after changing nginx config file, make sure reload nginx.
- make sure domains enabled. (ie: if yo put files in
sites-available, make sure there symlinkssites-enabled. - try simpler configurations. try configuration 1 domain, , try configuration other domain. try configuration serves simple static files.
- check dns. domains wish involve should resolve ip of vm. check each one:
dig +short example.com. - try changing order configurations appear in nginx config file. shouldn't apply because don't see wildcard matching, if nothing else working...
your nginx configurations show have separate server blocks unique server_name values configuration looks hosting multiple domains on single ip address.
(if happen have stripped out ssl configuration, there related issue, i'm assuming not based on configuration).
Comments
Post a Comment