Hey i installed Varnish on my Ubuntu 18.04 with Nginx. I set nginx to port 8090 on the /etc/nginx/sites-available/default and on /usr/local/ispconfig/server/conf/nginx_vhost.conf.master and on /vhost.conf.master, so now if i go on Resync all websites it tries to set the port on vhost to 80 (see on .err vhost) nginx_vhost.conf.master: Code: server { listen <tmpl_var name='ip_address'>:8090; <tmpl_if name='ipv6_enabled'> listen [<tmpl_var name='ipv6_address'>]:8090; </tmpl_if> vhost.conf.master: Code: </Directory> <tmpl_loop name='vhosts'> <tmpl_if name='port' op='==' value='8090'> <VirtualHost localhost:8090> <tmpl_else> <VirtualHost {tmpl_var name='ip_address'}:{tmpl_var name='port'}> </tmpl_if> default: Code: server { listen 8090 default_server; listen [::]:8090 default_server; So what i do wrong? Is there s noob friendly tutorial for setup ISPConfig with Nginx and Varnish?(these on howtoforge.com not work for me)
The customizedd nginx master template should be copied to /usr/local/ispconfig/server/conf-custom/ Maybe you even have a custom file with port 80 in there already. Actually, I would not use Varnish on nginx servers. with Apache, varnish makes sense. But nginx is so fast on its own that you probably will not get any speed improvements by installing varnish.
Ok thank you If i customize vhost.conf.master i save it to conf-custom/? Or in a subfolder from conf-custom/ And let the conf/vhost.conf.master untouched? So that all in conf/ is original and Only in conf-custom/ is modified? Or modify both in conf/ and custom-conf/?
Save the file to /conf-custom/ and don't alter the file in /conf/, the file in conf will get replaced on next update anyway, thats why modified files have to be saved in the conf-custom folder.
And I just noticed an error in your file, the one below should be correct. Code: </Directory> <tmpl_loop name='vhosts'> <tmpl_if name='port' op='==' value='80'> <VirtualHost localhost:8090> <tmpl_else> <VirtualHost {tmpl_var name='ip_address'}:{tmpl_var name='port'}> </tmpl_if>
ok now i delete varnish an make all back but now ispconfig monitor means webserver is offline, but nginx is runing on 80,443?
Probably you changed something in /etc/nginx/sites-available/default or in /etc/nginx/nginx.conf which causes nginx to not listen on localhost port 80 anymore.
/etc/nginx/sites-available/default: Code: ## # You should look at the following URL's in order to grasp a solid understanding # of Nginx configuration files in order to fully unleash the power of Nginx. # https://www.nginx.com/resources/wiki/start/ # https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/ # https://wiki.debian.org/Nginx/DirectoryStructure # # In most cases, administrators will remove this file from sites-enabled/ and # leave it as reference inside of sites-available where it will continue to be # updated by the nginx packaging team. # # This file will automatically load configuration files provided by other # applications, such as Drupal or Wordpress. These applications will be made # available underneath a path with that package name, such as /drupal8. # # Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. ## # Default server configuration # server { listen 80 default_server; listen [::]:80 default_server; # 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/html; # Add index.php to the list if you are using PHP index index.html index.htm index.nginx-debian.html; server_name _; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } # pass PHP scripts to FastCGI server # #location ~ \.php$ { # include snippets/fastcgi-php.conf; # # # With php-fpm (or other unix sockets): # fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; # # With php-cgi (or other tcp sockets): # fastcgi_pass 127.0.0.1:9000; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # Virtual Host configuration for example.com # # You can move that to a different file under sites-available/ and symlink that # to sites-enabled/ to enable it. # #server { # listen 80; # listen [::]:80; # # server_name example.com; # # root /var/www/example.com; # index index.html; # # location / { # try_files $uri $uri/ =404; # } #} /etc/nginx/nginx.conf: Code: user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { worker_connections 768; # multi_accept on; } http { map $remote_addr $ip_anonym1 { default 0.0.0; "~(?P<ip>(\d+)\.(\d+)\.(\d+))\.\d+" $ip; "~(?P<ip>[^:]+:[^:]+):" $ip; } map $remote_addr $ip_anonym2 { default .0; "~(?P<ip>(\d+)\.(\d+)\.(\d+))\.\d+" .0; "~(?P<ip>[^:]+:[^:]+):" ::; } map $ip_anonym1$ip_anonym2 $ip_anonymized { default 0.0.0.0; "~(?P<ip>.*)" $ip; } log_format anonymized '$ip_anonymized - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent"'; ## # Basic Settings ## include /etc/nginx/apps/pagespeed/core.conf; 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/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; # } #}
Can you say me how to find out which vhost runs on this port 8090 (i think i forgot one from this varnish things, because i listen for varnish on port 8090): Code: tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN 10052/nginx: master The x.x.xxx.xx is my server ip Code: netstat -ntap | grep 80 tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 10052/nginx: master tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 10052/nginx: master tcp 0 0 0.0.0.0:8081 0.0.0.0:* LISTEN 10052/nginx: master tcp 0 0 127.0.0.1:8082 0.0.0.0:* LISTEN 715/pushxx tcp 0 0 127.0.0.1:8083 0.0.0.0:* LISTEN 715/pushxx tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN 10052/nginx: master tcp 0 0 x.x.xxx.xx:42738 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42762 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 127.0.0.1:55520 127.0.0.1:80 TIME_WAIT - tcp 0 0 127.0.0.1:41154 127.0.0.1:8083 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42766 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 127.0.0.1:55518 127.0.0.1:80 TIME_WAIT - tcp 0 0 127.0.0.1:55508 127.0.0.1:80 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42756 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42740 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 127.0.0.1:55514 127.0.0.1:80 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42750 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 127.0.0.1:55502 127.0.0.1:80 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42746 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 127.0.0.1:55536 127.0.0.1:80 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42764 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42754 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 127.0.0.1:55526 127.0.0.1:80 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42730 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42758 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 127.0.0.1:55506 127.0.0.1:80 TIME_WAIT - tcp 0 0 127.0.0.1:55534 127.0.0.1:80 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42728 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 x.x.xxx.xx:8080 x.x.xxx.xx:2225 TIME_WAIT - tcp 0 0 127.0.0.1:55532 127.0.0.1:80 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42726 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42744 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 127.0.0.1:55524 127.0.0.1:80 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42760 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42736 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 127.0.0.1:55490 127.0.0.1:80 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42742 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42748 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42752 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42734 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 127.0.0.1:55512 127.0.0.1:80 TIME_WAIT - tcp 0 0 x.x.xxx.xx:42732 x.x.xxx.xx:8080 TIME_WAIT - tcp 0 0 x.x.xxx.xx:8080 x.x.xxx.xx:2260 ESTABLISHED 10053/nginx: worker tcp6 0 0 :::80 :::* LISTEN 10052/nginx: master tcp6 0 0 :::8080 :::* LISTEN 10052/nginx: master