nginxproblem mit vhots und lokaler Installation

Debian macht sich hervorragend als Web- und Mailserver. Schau auch in den " Tipps und Tricks"-Bereich.
Antworten
schwedenmann
Beiträge: 5525
Registriert: 30.12.2004 15:31:07
Wohnort: Wegberg

nginxproblem mit vhots und lokaler Installation

Beitrag von schwedenmann » 18.09.2017 10:12:15

Hallo

Habe auf einem Debian (Debian-Sid, amd64, openbox) nginx installiert. Aufruf von localhost im Browser zeigt die typ. debian-nginx Willkommensseite an. php7 , bzw. eine phpinfo-Datei im documentroot (/var/www/html) funktioniert auch.
Jetzt habe ich 2 vhosts angelegt, Einträge in /etc/hosts und entsprechende docuemntroot in /var/www angelgt, aber es kommt die Fehlermeldung: es konnte keine Verbindung zum Server hergestellt werden.
Kann mal eienr über die entsprechenden Dateien (werden hier geostet) drüberschauen, ich bin seit Samstag dran und finde den Fehler nicht.


ls-l von /var/www
ls -l /var/www
insgesamt 12
drwxr-xr-x 2 root root 4096 Aug 26 12:43 html
drwxr-xr-x 2 www-data www-data 4096 Sep 17 19:15 meinserver2.local
drwxr-xr-x 2 www-data www-data 4096 Sep 17 19:16 testserver.local
root@opendebian:/home/joerg#
/etc/hosts
127.0.0.1 localhost
127.0.1.1 opendebian
192.168.178.50 meinserver1
192.168.178.50 meinserver2.local
192.168.178.50 testserver.local
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
192.168.178.30 duron1800
/etc/nginx/nginx.conf
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
worker_connections 768;
# multi_accept on;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
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;

##
# SSL Settings
##

ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;

##
# Logging Settings
##

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

##
# Gzip Settings
##

gzip on;

# 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/javascript text/xml application/xml application/xml+rss text/javascript;

##
# Virtual Host Configs
##

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


#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateW ... ePhpScript
#
# # 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;
#
vhosts1
server {
listen 80;

server_name meinserver1;

#rewrite ^ https://testsite.com$request_uri? permanent;
}

server {


server_name meinserver1;

root /var/www/meinserver1;

location / {
try_files $uri /index.php?$args;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}

}
vhost2
server {
listen 80 ;
listen [::]:80 ;

# SSL configuration
#
# listen 443 ssl default_server;
# listen [::]:443 ssl default_server;
#
# Note: You should disable gzip for SSL traffic.
# See: https://bugs.debian.org/773332
#
# Read up on ssl_ciphers to ensure a secure configuration.
# See: https://bugs.debian.org/765782
#
# Self signed certs generated by the ssl-cert package
# Don't use them in a production server!
#
# include snippets/snakeoil.conf;

root /var/www/meinserver2.local;

# Add index.php to the list if you are using PHP
index index.html index.htm index.nginx-debian.html;

server_name meinserver2.local;

location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
include snippets/fastcgi-php.conf;

# With php7.0-cgi alone:
# fastcgi_pass 127.0.0.1:9000;
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
location ~ /\.ht {
deny all;
}
}
Die vhosts und die nginx.conf habe ich aus Frust von meinem Hauptsystem rüberkopeirt (dort funktionieren die vhosts Einträge), nur habe ich dort ein anderes docuemntroot (eigene Partition), die entsprechenden Eintäge habe ich natürlich geändert. links zu /etc/nginx/sites-enabled sind natürlich vorhanden :lol:

Ich hoffe jemnd findet etwas

Ach, der nginx läuft natürlich!

mfg
schwedenmann

Antworten