SOLVED Possible? Nginx and Apache on same machine both using SSL

My domain is: backend.atavismxi.com and cloud.atavismxi.com

I ran this command: sudo certbot --apache -d cloud.atavismxi.com

It produced this output:
Deploying certificate
Successfully deployed certificate for cloud.atavismxi.com to /etc/httpd/conf/extra/nextcloud-le-ssl.conf
Congratulations! You have successfully enabled HTTPS on https://cloud.atavismxi.com

My web server is (include version): Apache and Nginx

The operating system my web server runs on is (include version): Arch Linux

My hosting provider, if applicable, is: Netlify

I can login to a root shell on my machine (yes or no, or I don't know): Yes

I'm using a control panel to manage my site (no, or provide the name and version of the control panel):

The version of my client is (e.g. output of certbot --version or certbot-auto --version if you're using Certbot): 1.21

Hello~ I might be asking this at wrong place. If I am please forgive me and I'll move onto some place like apache forums or next cloud forums.

My problem is that I have a server setup with nginx and apache. Used certbots with both to obtain certficates and both seem to work fine. Problem is that I can't run nginx and apache at the same time. Apache says things like this when I start it:
(98)Address already in use: AH00072: make_sock: could not bind to address [::]:443
So I believe that means nginx is already using port 443 and apache can't use it? I have nginx configured to use port 80 and apache using port 8080. Is there a way to use both apache and nginx on port 443?

Not on the same IP.
What is it you are trying to accomplish?

1 Like

Show:
netstat -pant | grep -i listen | grep 443

1 Like

What I'm trying to accomplish: I'm trying to keep my website running and setup nextcloud

Ahhh... OK
But why have both Apache and nginx ?

1 Like

tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN 73091/nginx: master

Well I tried to get Nextcloud working with nginx.......couldn't do it. Wouldn't even load without SSL and just using port 8080. I can go back to trying that if I need to. I probably just had something wrong in my nginx server block. Apache works fine without SSL using port 8080.

If you "copy" the vhost details of the working apache on 8080, you should be able to use them in nginx with 443.

1 Like

OK. That took a while. But good advice. I copied the template for nginx from next cloud: NGINX configuration — Nextcloud latest Administration Manual latest documentation
Changed server name to cloud.testing.com
changed root to /usr/share/webapps/nextcloud/
changed the ssl lines to my ssl certficate

Still didn't work. Then i saw on the arch linux wiki it says to use
server unix:/run/nextcloud/nextcloud.sock;

instead of server 127.0.0.1:9000; that the nextcloud documents says to use

Then it worked with nginx and I have SSL with both servers.

You're amazing

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.