nginx virtualhosts
Kenneth Demanawa
kdemanawa at gmail.com
Tue Jan 8 19:32:41 MSK 2008
you have nested two "servers" directive. check your your closing
parenthesis for your first server directive. :)
On Jan 9, 2008 12:12 AM, Stefanita rares Dumitrescu
<lists at ruby-forum.com> wrote:
> hi guys, i am having some issues with virtualhosting in nginx:
>
> the config below:
>
> i want to make both host1.com and host2.com work, and serve static
> content directly.
>
> http {
> include mime.types;
> default_type application/octet-stream;
> server_names_hash_bucket_size 128;
> 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 logs/access.log main;
> sendfile on;
> #tcp_nopush on;
> keepalive_timeout 20;
> #gzip on;
>
> server {
> listen xx.xx.xx.xx:80;
> server_name host1.com;
> #charset koi8-r;
> access_log logs/host1.com.access.log main;
> location /data {
> root /home/fs01/storage;
> internal;
> }
> location / {
> root /home/fs01/www;
> index index.html index.htm index.php;
> }
>
> location / {
> proxy_pass http://localhost:8000/;
> proxy_redirect off;
> proxy_set_header X-Forwarded-For
> $proxy_add_x_forwarded_for;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header Host $http_host;
>
> }
> server {
> listen xx.xx.xx.xx:80;
> server_name host2.com;
> #charset koi8-r;
> access_log logs/host2.com.access.log main;
> location / {
> access_log
> logs/host2.com.access.log main;
> location / {
> root /home/m1emuz/public_html;
> internal;
> }
> location / {
> root /home/fs01/www;
> index index.html index.htm index.php;
> }
>
> location / {
> proxy_pass http://localhost:8000/;
> proxy_redirect off;
> proxy_set_header X-Forwarded-For
> $proxy_add_x_forwarded_for;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header Host $http_host;
>
> }
>
>
> # serve static files directly
> location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|flv|zip)$ {
> root /home/fs01/storage;
> access_log off;
> expires 30d;
> }
>
> # serve static files directly
> location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|flv|zip)$ {
> root /home/m1emuz/public_html;
> access_log off;
> expires 30d;
> }
>
>
> # redirect server error pages to the static page /50x.html
> #
> error_page 500 502 503 504 /50x.html;
> location = /50x.html {
> root /usr/local/www/nginx-dist;
> }
>
>
>
> # deny access to .htaccess files, if Apache's document root
> # concurs with nginx's one
> #
> #location ~ /\.ht {
> # deny all;
> #}
>
> the error i am getting when restarting the nginx.
>
> Starting nginx.
> 2008/01/08 16:15:23 [emerg] 88032#0: "server" directive is not allowed
> here in /usr/local/etc/nginx/nginx.conf:47
>
> nginx version: nginx/0.5.34
>
> thanks. much appreciated.
> --
> Posted via http://www.ruby-forum.com/.
>
>
More information about the nginx
mailing list