Help configure Apache. I have several sites included in apache. There is a ports.conf file in which Listen: 80 is written, which almost suits me. But for one single domain I want to change this very Listen from port 80 to port 8080. What I want to achieve: I want the handler to connect Nginx but not for all sites on the server, but only for one. In the apache file of this site I have
<VirtualHost *:8080> <Directory /var/www/html/my-domain> Options FollowSymLinks AllowOverride All </Directory> ServerAdmin admin@mail.ru ServerName my-domain.ru DocumentRoot /var/www/html/my-domain ErrorLog ${APACHE_LOG_DIR}/error-my-domain.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> I have written in the Nginx conf file of this site
server { listen 80; root /var/www/html/my-domain; index index.php index.html index.htm; server_name my-domain.ru; location / { try_files $uri $uri/ /index.php; } location ~ \.php$ { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host $host; proxy_pass http://127.0.0.1:8080; } location ~ /\.ht { deny all; } } Both Apache and Nginx are running, but when entering my-domain.ru, Apache is included in the processing. And when I go to my-domain.ru:8080 Nginx works.
Contents of the /etc/nginx/nginx.conf file
user www-data; worker_processes 2; # Ставим число по количеству ядер timer_resolution 100ms; worker_rlimit_nofile 8192; worker_priority -5; #Увеличитвваем приоритет error_log /var/log/nginx/error.log; pid /var/run/nginx.pid; events { worker_connections 1024; } http { access_log /var/log/nginx/access.log; sendfile on; keepalive_timeout 65; tcp_nodelay on; gzip on; gzip_min_length 1100; #gzip_disable "msie6"; #Быстрее, но работает только на новых версиях nginx gzip_disable "MSIE [1-6]\.(?!.*SV1)"; gzip_proxied any; gzip_comp_level 4; gzip_types text/plain text/css application/x-javascript text/xml application/xml $ gzip_vary on; include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*; }
ProxyPass / http://localhost:8080 ProxyPreserveHost On <Proxy *> Order deny,allow Allow from all </Proxy>