T
T
Toronto2014-07-09 19:55:01
Nginx
Toronto, 2014-07-09 19:55:01

The nginx + apache2 + ispmanager bundle does not work, what am I doing wrong?

Hello!
The essence of the problem is this:
IspMgr is installed on the debian 7 (x64) server, from the panel of which apache2 and nginx were installed.
Initially, apache2 hangs on port 81 of
Nginx, it hangs on 443
And this is all on the external IP.
So, how to make apache2 work on 127.0.0.1:8080 and nginx on 80 and at the same time close port 81 and 443
And also, when domains were added to IspMgr, virtual hosts are not created quite correctly.

The apache2 config is standard as IspMgr installed it:
# This is the main Apache server
# Include module configuration:
Include mods-enabled/*.load
Include mods-enabled/*.conf
# Include list of ports to listen on and which to use for name based vhosts
Include ports.conf
#
# The following directives define some format nicknames for use with
# a CustomLog directive (see below).
# If you are behind a reverse proxy, you might want to change %h into %{X-Forwarded-For}i
#
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
# Include of directories ignores editors' and dpkg's backup files,
# see the comments above for details.
# Include generic snippets of statements
Include conf.d/
# Include the virtual host configurations:
Include sites-enabled/
Include /usr/local/ispmgr/etc/ispmgr.inc
php_admin_flag engine off
ports.conf
# If you just change the port or add more ports here, you will likely also
# have to change the VirtualHost statement in
# /etc/apache2/sites-enabled/000-default
# This is also true if you have upgraded from before 2.2.9-3 (i.e. from
# Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and
# README.Debian.gz
NameVirtualHost *:80
Listen 81
# If you add NameVirtualHost *:443 here, you will also have to change
# the VirtualHost statement in /etc/apache2/sites-available/default-ssl
# to
# Server Name Indication for SSL named virtual hosts is currently not
# supported by MSIE on Windows XP.
Listen 443
Listen 443

IspMgr creates virtual hosts in nginx.conf and apache2.conf themselves
And this is how I have it in ispmgr.conf
Service "HTTP" {
Confname apache2
Monitored NO
Process apache2
Start /etc/init.d/apache2 start
Stop /etc/init.d/apache2 stop
Type www
Ip xx.xx.xx.xx 81
}
Service "FTP" {
Confname proftpd
Monitored NO
Process proftpd
Start /etc/init.d/proftpd start
Stop /etc/init.d/proftpd stop
Type ftp
}
Service "MySQL" {
Confname mysql
Monitored NO
Process mysqld
Start /etc/init.d/mysql start
Stop /etc/init.d/mysql stop
Type mysql
Ip /var/run/mysqld/mysqld.sock
}
Service "DNS" {
Confname bind9
Monitored NO
Process named
Start /etc/init.d/bind9 start
Stop /etc/init.d/bind9 stop
Type dns
}
Service "Nginx" {
Confname nginx
Monitored NO
Process nginx
Start /etc/init.d/nginx start
Stop /etc/init.d/nginx stop
Type process
}
nginx.domain
server {
listen xx.xx.xx.xx:443;
server_name xx.xx.xx.xx;
ssl on;
ssl_certificate /usr/local/ispmgr/etc/manager.crt;
ssl_certificate_key /usr/local/ispmgr/etc/manager.key;
include /usr/local/ispmgr/etc/nginx.inc;
location / {
proxy_pass $mgr_proxy;
proxy_redirect $mgr_proxy /;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Secret 22Vz/Qkjps6tjJ97ExT6zPum;
chunked_transfer_encoding off;
}
location ~* ^/(webstat|awstats|webmail|myadmin|pgadmin)/ {
proxy_pass http://xx.xx.xx.xx:81;
proxy_redirect xx.xx.xx.xx:81 /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Secret 22Vz/Qkjps6tjJ97ExT6zPum;
}
}

and
nginx.inc
set $mgr_proxy "xx.xx.xx.xx:1500";
location ^~ /manimg/ {
alias /usr/local/ispmgr/skins/;
}
location ^~ /manager {
proxy_pass $mgr_proxy;
proxy_redirect $mgr_proxy /;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Manager-Path /manager;
proxy_set_header X-Secret 22Vz/Qkjps6tjJ97ExT6zPum;
chunked_transfer_encoding off;
}
location ^~ /mancgi/ {
proxy_pass $mgr_proxy;
proxy_redirect $mgr_proxy /;
proxy_set_header Host $host:$server_port;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Secret 22Vz/Qkjps6tjJ97ExT6zPum;
chunked_transfer_encoding off;
}

I tried to change ports in various ways, nothing works, nginx refuses to work, and when creating virtual hosts ispmgr sets the following parameters:
location ~* ^/(webstat|awstats|webmail|myadmin|pgadmin)/ {
proxy_pass http://xx. xx.xx.xx:81;
proxy_redirect xx.xx.xx.xx:81 /;
What a day I’ve been fighting, I can’t beat them into the ports I need, and even so that it all works correctly

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Voitenko, 2014-07-09
@OliverV

change templates. All entries in your files are made from templates, and port 81 is registered in them.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question