hatahata Posted May 2, 2016 Posted May 2, 2016 hi all . i run odoroid-c2 foremaly i runed nginx with auth basic by next nginx.conf successfully in orange pi PC . nginx.conf is ------------- events { worker_connections 800; }http { include mime.types; default_type application/octet-stream; index index.html index.htm; keepalive_timeout 65; server_tokens off;server { listen 80; server_name localhost; #<-for test #root /var/www/d1; root /var/www/d2; }server { listen 80; server_name n------------n.dip.jp; root /var/www/d2; auth_basic "closed site"; auth_basic_user_file /var/www/2/.htpasswd; }server { listen 80; server_name s----------------s.mydns.jp; root /var/www/d1; auth_basic "closed site"; auth_basic_user_file /var/www/1/.htpasswd; } }but [ /etc/init.d/nginx restart ] fails in odoroid-c2 . i love nginx but fail . so i am forced to run apache2 . head apache2.conf ---------------------------------------- NameVirtualHost *:80<VirtualHost *:80>ServerName s-----------------s.mydns.jpDocumentRoot /var/www/d1</VirtualHost><VirtualHost *:80>ServerName n---------------n.dip.jpDocumentRoot /var/www/d2</VirtualHost><Directory "/var/www/d1"> AuthType Basic AuthName "D1" AuthUserFile /var/www/1/.htpasswd Require user emi</Directory><Directory "/var/www/d2"> AuthType Basic AuthName "D2" AuthUserFile /var/www/2/.htpasswd Require user fuji</Directory> what is wrong with nginx.conf ? ------------------------- regards
hatahata Posted May 3, 2016 Author Posted May 3, 2016 thanks for reply . /etc/init.d/nginx restart[....] Restarting nginx (via systemctl): nginx.serviceJob for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details. failed! systemctl status nginx.service◠nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled) Active: failed (Result: exit-code) since 水 2016-05-04 07:30:04 JST; 45s ago Process: 2331 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE) Process: 2389 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE) 5月 04 07:30:04 odroidc2 nginx[2389]: nginx: [emerg] could not build the server_...32 5月 04 07:30:04 odroidc2 nginx[2389]: nginx: configuration file /etc/nginx/nginx...ed 5月 04 07:30:04 odroidc2 systemd[1]: nginx.service: control process exited, code...=1 5月 04 07:30:04 odroidc2 systemd[1]: Failed to start A high performance web serv...r. 5月 04 07:30:04 odroidc2 systemd[1]: Unit nginx.service entered failed state.Hint: Some lines were ellipsized, use -l to show in full. journalctl -xn-- Logs begin at 水 2016-05-04 07:08:39 JST, end at 水 2016-05-04 07:31:08 JST. -- 5月 04 07:30:58 odroidc2 nodm[2417]: pam_systemd(nodm:session): Failed to release sess 5月 04 07:30:58 odroidc2 nodm[2417]: pam_close_session: Cannot make/remove an entry fo 5月 04 07:30:58 odroidc2 nodm[580]: X session 2417 quit with status 0 5月 04 07:30:58 odroidc2 nodm[580]: sending X server 2412 the TERM signal 5月 04 07:30:58 odroidc2 kernel: fb: osd[0] canvas.idx =0x40 5月 04 07:30:58 odroidc2 kernel: fb: osd[0] canvas.addr=0x78000000 5月 04 07:30:58 odroidc2 kernel: fb: osd[0] canvas.width=5760 5月 04 07:30:58 odroidc2 kernel: fb: osd[0] canvas.height=2160 5月 04 07:30:58 odroidc2 nodm[580]: session lasted less than 60 seconds: sleeping 60 s 5月 04 07:31:08 odroidc2 systemd-logind[519]: Removed session c22.-- Subject: A session c22 has been terminated-- Defined-By: systemd-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel-- Documentation: http://www.freedesktop.org/wiki/Software/systemd/multiseat---- A session with the ID c22 has been terminated. cat /var/log/nginx/error.log2016/05/02 23:23:45 [emerg] 12720#0: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 322016/05/02 23:23:56 [emerg] 12753#0: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 322016/05/02 23:26:32 [emerg] 12816#0: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 322016/05/02 23:31:02 [emerg] 12960#0: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 322016/05/02 23:37:29 [emerg] 13084#0: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 322016/05/02 23:40:07 [emerg] 13158#0: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 322016/05/03 00:03:03 [emerg] 13518#0: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 322016/05/04 07:28:53 [emerg] 2248#0: bind() to 0.0.0.0:80 failed (98: Address already in use)2016/05/04 07:28:53 [emerg] 2248#0: bind() to [::]:80 failed (98: Address already in use)2016/05/04 07:28:53 [emerg] 2248#0: bind() to 0.0.0.0:80 failed (98: Address already in use)2016/05/04 07:28:53 [emerg] 2248#0: bind() to [::]:80 failed (98: Address already in use)2016/05/04 07:28:53 [emerg] 2248#0: bind() to 0.0.0.0:80 failed (98: Address already in use)2016/05/04 07:28:53 [emerg] 2248#0: bind() to [::]:80 failed (98: Address already in use)2016/05/04 07:28:53 [emerg] 2248#0: bind() to 0.0.0.0:80 failed (98: Address already in use)2016/05/04 07:28:53 [emerg] 2248#0: bind() to [::]:80 failed (98: Address already in use)2016/05/04 07:28:53 [emerg] 2248#0: bind() to 0.0.0.0:80 failed (98: Address already in use)2016/05/04 07:28:53 [emerg] 2248#0: bind() to [::]:80 failed (98: Address already in use)2016/05/04 07:28:53 [emerg] 2248#0: still could not bind()2016/05/04 07:28:58 [emerg] 2331#0: bind() to 0.0.0.0:80 failed (98: Address already in use)2016/05/04 07:28:58 [emerg] 2331#0: bind() to [::]:80 failed (98: Address already in use)2016/05/04 07:28:58 [emerg] 2331#0: bind() to 0.0.0.0:80 failed (98: Address already in use)2016/05/04 07:28:58 [emerg] 2331#0: bind() to [::]:80 failed (98: Address already in use)2016/05/04 07:28:58 [emerg] 2331#0: bind() to 0.0.0.0:80 failed (98: Address already in use)2016/05/04 07:28:58 [emerg] 2331#0: bind() to [::]:80 failed (98: Address already in use)2016/05/04 07:28:58 [emerg] 2331#0: bind() to 0.0.0.0:80 failed (98: Address already in use)2016/05/04 07:28:58 [emerg] 2331#0: bind() to [::]:80 failed (98: Address already in use)2016/05/04 07:28:58 [emerg] 2331#0: bind() to 0.0.0.0:80 failed (98: Address already in use)2016/05/04 07:28:58 [emerg] 2331#0: bind() to [::]:80 failed (98: Address already in use)2016/05/04 07:28:58 [emerg] 2331#0: still could not bind()2016/05/04 07:30:04 [emerg] 2389#0: could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32
help40 Posted May 14, 2016 Posted May 14, 2016 SOrry for late reply , but I'm a little confused because in previous message we were talking about another kind of mistake .. about Basic Auth ? first for Auth I think your code must be in "location { ..... }" section , not just in "server { ..... } this is the way in my configs .... and so is written here http://nginx.org/en/docs/http/ngx_http_auth_basic_module.html so it will be server { listen 80; server_name n------------n.dip.jp; root /var/www/d2; location / { auth_basic "closed site"; auth_basic_user_file /var/www/2/.htpasswd; } } as for "you should increase server_names_hash_bucket_size: 32" check here http://nginx.org/en/docs/http/server_names.html you have very long site names and .... you should have http { server_names_hash_bucket_size 64; hope it helps
Recommended Posts