Vhost problems with dash in URL
January 26, 2014 06:57AM
Hallo and sorry für cross posting. I write this question in the german forum but i dont get a answer.

I setup a nginx Server with ISPConfig3 and it work well. Simply one thing disturb. I own a Domain with dash "www.shopping-ffm.de". If i configure them i get a error in the config of vhost. I arrive only of the main side from nginx.

I visit the file shopping-ffm.de.vhost in sites-available and see the writing syntaxerror in config. I rename the .err file and try what happend. The error ist prouced by server_name. If i take the dash out from the Name the config is loaded. I tried ', ", [ and * but it does not help. Only *.de work properly. Unfortunately i have 3 Domains on the server with dash :-( Only one i can resolve like this.

Did somebody have a idea what i do wrong?
Sorry for my english! Thanks for your help.

Greetings Mike
Re: Vhost problems with dash in URL
January 26, 2014 07:13AM
Post nginx.conf and relevant parts for this site so we can all have a look where its going wrong.
Re: Vhost problems with dash in URL
January 26, 2014 07:28AM
the nginx.conf:

user www-data;
worker_processes 4;
pid /run/nginx.pid;

events {
worker_connections 768;
# multi_accept on;
}

http {

##
# Basic Settings
##

sendfile off;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 2;
types_hash_max_size 2048;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

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

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;
gzip_disable "msie6";

# gzip_vary on;
# gzip_proxied any;
# gzip_comp_level 6;
# gzip_buffers 16 8k;
# gzip_http_version 1.1;
# gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;

##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##

#include /etc/nginx/naxsi_core.rules;

##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##

#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;

## Detect when HTTPS is used
map $scheme $fastcgi_https {
default off;
https on;
}

}


#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}

and shopping-ffm.de.vhost:

server {
listen *:80;

server_name *.de;

root /var/www/shopping-ffm.de/web;

index index.html index.htm index.php index.cgi index.pl index.xhtml;

error_page 400 /error/400.html;
error_page 401 /error/401.html;
error_page 403 /error/403.html;
error_page 404 /error/404.html;
error_page 405 /error/405.html;
error_page 500 /error/500.html;
error_page 502 /error/502.html;
error_page 503 /error/503.html;
recursive_error_pages on;
location = /error/400.html {

internal;
}
location = /error/401.html {

internal;
}
location = /error/403.html {

internal;
}
location = /error/404.html {

internal;
}
location = /error/405.html {

internal;
}
location = /error/500.html {

internal;
}
location = /error/502.html {

internal;
}
location = /error/503.html {

internal;
}

error_log /var/log/ispconfig/httpd/shopping-ffm.de/error.log;
access_log /var/log/ispconfig/httpd/shopping-ffm.de/access.log combined;

location ~ /\. {
deny all;
access_log off;
log_not_found off;
}

location = /favicon.ico {
log_not_found off;
access_log off;
}

location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

location /stats {

index index.html index.php;
auth_basic "Members Only";
auth_basic_user_file /var/www/clients/client1/web19/web/stats/.htpasswd_stats;
}

location ^~ /awstats-icon {
alias /usr/share/awstats/icon;
}

location ~ \.php$ {
try_files /f6c66fb7541e84e6084faab17f33d66a.htm @php;
}

location @php {
deny all;
}
}

Thanks for your help.

Greetings Mike
Re: Vhost problems with dash in URL
January 26, 2014 07:31AM
May be helpful: Nginx version 1.41 on Ubuntu 12. If i Change Server_name to shopping-ffm.de the file is not working.
Re: Vhost problems with dash in URL
January 26, 2014 08:08AM
Maybe this:
http://serverfault.com/questions/347586/nginx-warns-server-name-has-strange-symbols
If not what does the logs say?
Re: Vhost problems with dash in URL
January 26, 2014 08:38AM
Hi itpp2012, the ; is in ther. After i Change vhost-file to Server_name shopping-ffm.de and restart nginx the error.log say [emerg] 232754#0: could not build zhe Server_names_hash, you should increase Server_names_hash_bucket_size: 32
Re: Vhost problems with dash in URL
January 26, 2014 08:41AM
I cant belive - thanks for help the Problem was the line Server_names_hash_bucket_size in nginx.conf. I activate her and it work. Thanks a lot!!!!!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 258
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