-2

I have an Apache server, on this server I have a bunch of WordPress websites, and this year I started creating React apps.

I have been able to change :80 for Nginx and :8080 for apache, the problem is that when I change the port in WHM tweaks from 443 to 8443 my WordPress website stop working. And if I leave it default then my Nginx conf send this error nginx: [emerg] bind() to 0.0.0.0:443 failed (98: Address already in use)

The code I'm trying to use for my conf to load the app is

server {
  listen *:80;
  listen [::]:80;

  server_name plitz7.com www.plitz7.com;
  return 301 https://$server_name$request_uri;
}

server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;

  server_name plitz7.com www.plitz7.com;
  root /home/allplitz/plitzseven;

  location / {
        proxy_pass http://localhost:5001;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_cache_bypass $http_upgrade;
  }

  ssl_certificate /var/cpanel/ssl/apache_tls/plitz7.latinconstructions.com/combined;
  ssl_certificate_key /var/cpanel/ssl/apache_tls/plitz7.latinconstructions.com/combined;
}

Thanks, I hope someone can help me, so far the only solutions I found is to change the port, but then my Apache https website stop working, so I need a solution that can work for both.

1 Answers1

0

When changing Apache's ports, it should work correctly, you say that wordpress doesn't work and it is possible that it won't find it once you change the ports that are modified in /etc/apache2/ports.conf, since you also have to change the ports in each of Apache's virtualhosts (/etc/apache2/sites-available) because if one references your worpdress page it won't find it because the virtualhost doesn't listen for the correct port.

<VirtualHost *:8080>
...
</VirtualHost>
Luis13
  • 71
  • 4
  • Hi Luis, I chane the port 80 to 8080. The one that doesn’t work is the port 443 to 8443. Changing the port gives me error. I change the port 443 to 8443 in Apache to all my sites and then the 443 works in Nginx but the Apache sites show an SSL error. Now I get another IP but I don’t know how to make it work with two different IP. I think the problem is that I need emails, so I added the domain via cPanel, but for the website I need it from another folder because is a MERN stack. – Norman at Plitz7 Jun 22 '20 at 10:49