# Changing Apache port

**URL:** <https://discourse.openondemand.org/t/changing-apache-port/1539>\
**Category:** Get Help\
**Tags:** ondemand2, question\
**Created:** [June 15, 2021, 1:18pm UTC](https://discourse.openondemand.org/t/changing-apache-port/1539 "2021-06-15T13:18:58Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![MohsenQazi](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mohsenqazi/32/715_2.png) [@MohsenQazi](https://discourse.openondemand.org/u/MohsenQazi)\
**Post date:** [June 15, 2021, 1:18pm UTC](https://discourse.openondemand.org/t/changing-apache-port/1539/1 "2021-06-15T13:18:58Z")

</div>

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:

```auto
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?

---

<div class="post-metadata">

**Author:** ![travert](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/travert/32/3074_2.png) [@travert](https://discourse.openondemand.org/u/travert)\
**Post date:** [June 15, 2021, 6:13pm UTC](https://discourse.openondemand.org/t/changing-apache-port/1539/2 "2021-06-15T18:13:20Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![MohsenQazi](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mohsenqazi/32/715_2.png) [@MohsenQazi](https://discourse.openondemand.org/u/MohsenQazi)\
**Post date:** [June 16, 2021, 4:32am UTC](https://discourse.openondemand.org/t/changing-apache-port/1539/3 "2021-06-16T04:32:24Z")

</div>

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

```

The out is just:

```auto
  OIDCSessionInactivityTimeout 28800
  OIDCSessionMaxDuration 28800

```

---

<div class="post-metadata">

**Author:** ![travert](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/travert/32/3074_2.png) [@travert](https://discourse.openondemand.org/u/travert)\
**Post date:** [June 16, 2021, 7:26pm UTC](https://discourse.openondemand.org/t/changing-apache-port/1539/4 "2021-06-16T19:26:16Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![MohsenQazi](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mohsenqazi/32/715_2.png) [@MohsenQazi](https://discourse.openondemand.org/u/MohsenQazi)\
**Post date:** [June 17, 2021, 3:52am UTC](https://discourse.openondemand.org/t/changing-apache-port/1539/5 "2021-06-17T03:52:27Z")

</div>

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

```auto
/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` :

 ![Screenshot_2021-06-17_09-06-53](https://us1.discourse-cdn.com/flex015/uploads/osc/original/1X/d08b9086fcfcde8cdd4c14659e1e52d8d0e4936e.png)

---

<div class="post-metadata">

**Author:** ![travert](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/travert/32/3074_2.png) [@travert](https://discourse.openondemand.org/u/travert)\
**Post date:** [June 17, 2021, 2:15pm UTC](https://discourse.openondemand.org/t/changing-apache-port/1539/6 "2021-06-17T14:15:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MohsenQazi](https://sea1.discourse-cdn.com/flex015/user_avatar/discourse.openondemand.org/mohsenqazi/32/715_2.png) [@MohsenQazi](https://discourse.openondemand.org/u/MohsenQazi)\
**Post date:** [June 19, 2021, 4:49am UTC](https://discourse.openondemand.org/t/changing-apache-port/1539/7 "2021-06-19T04:49:26Z")

</div>

Thank you @travert

Commenting out the default port in `/opt/rh/httpd24/root/etc/httpd/conf/httpd.conf` solved the problem. 👍

---

<div class="post-metadata">

**Author:** ![westburg.2](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@westburg.2](https://discourse.openondemand.org/u/westburg.2)\
**Post date:** [May 26, 2022, 3:42pm UTC](https://discourse.openondemand.org/t/changing-apache-port/1539/8 "2022-05-26T15:42:53Z")

</div>


