Changing Apache port

Hi everyone.

I successfully installed OOD 2.0.9
I have another Apache on port 80. So,

  1. I change the “port” in /etc/ood/config/ood_portal.yml to the 8181
  2. sudo firewall-cmd --zone=public --add-port=8181/tcp --permanent && sudo firewall-cmd --reload
  3. sudo /opt/ood/ood-portal-generator/sbin/update_ood_portal
  4. sudo systemctl try-restart httpd24-httpd.service httpd24-htcacheclean.service
    but httpd24 wont start and systemctl status -l httpd24-httpd.service says:
httpd-scl-wrapper[6913]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
httpd-scl-wrapper[6913]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80

How can i effectively change the OOD Apache port?

Hi Mohsen! Sorry about the port trouble. Just a couple quick questions.

After running update_ood_portal can you see the changes applied in the config file for httpd in
/opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf?

Do you see any entry in that ood-portal.conf file that is trying to use port 80 as well?

cat /opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf | grep 80

The out is just:

  OIDCSessionInactivityTimeout 28800
  OIDCSessionMaxDuration 28800

Thanks for the update. Since I’m not seeing that port being set in the ood_portal.conf, and you mentioned apache is using port 80 elsewhere, it would help to know what else is using the port.

Could you run:
grep -r 80 /opt/rh/httpd24/root/etc/httpd/conf.d/ | grep -v '#'

Mainly looking to see if there are any particular addresses binding to the port before a global bind, but also to make sure there isn’t some strange duplication going on.

Also, when you set the port initially, did you set the listen_addr_port: 8181 in ood_portal.yml as well?

The output of grep -r 80 /opt/rh/httpd24/root/etc/httpd/conf.d/ | grep -v '#' is:

/opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf:  OIDCSessionInactivityTimeout 28800
/opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf:  OIDCSessionMaxDuration 28800
/opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf.20210615T162853:<VirtualHost *:80>
/opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf.20210615T162853:  RewriteCond %{HTTP_HOST} !^(172.21.99.43(:80)?)?$ [NC]
/opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf.20210615T162853:  RewriteRule ^(.*) http://172.21.99.43:80$1 [R=301,NE,L]
/opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf.20210615T162853:  OIDCSessionInactivityTimeout 28800
/opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf.20210615T162853:  OIDCSessionMaxDuration 28800

The result is same with or without listen_addr_port: 8181 !

Also, visiting 172.21.99.43:8181 shows up OOD portal which is natural but 172.21.99.43:80 :

Just to be sure, the OOD portal is now showing up for you on port 8181, is that correct?

The default apache page is likely showing because of the default apache config itself at:
/opt/rh/httpd24/root/etc/httpd/conf/httpd.conf

Find the listen directive in that conf and comment it out:
#Listen 80

And that should stop the requests on port 80 from being served after reloading the apache config.

Thank you @travert

Commenting out the default port in /opt/rh/httpd24/root/etc/httpd/conf/httpd.conf solved the problem. :+1: