Hi sir please give the suggestion how to change port number i am chanced port number 80 to other numbers at the location of .httpdconf file- listen changed even its not changed??

Dani AI

Generated

A few focused checks to bridge what , and already hinted at.

Common reasons a changed port looks like it “did nothing”: the running daemon never re-read the edited file; you edited a file that isn’t actually included; another process still holds the old port; virtual-hosts are still bound to the original port; or the system firewall / SELinux blocks the new port. Confirm each of those rather than changing the same file again.

Quick, low-impact diagnostics you can run (examples — adapt to your distro):

ss -ltnp                # show TCP listeners and owning PID
lsof -nP -iTCP -sTCP:LISTEN
grep -R --line-number "^[[:space:]]*Listen" /etc 2>/dev/null
grep -R --line-number "<VirtualHost" /etc 2>/dev/null

If you find multiple “Listen” lines, or a VirtualHost section still targets the old port, update them so they match. Example VirtualHost for port 8080:

<VirtualHost *:8080>
    ServerName example.com
    DocumentRoot /var/www/html
</VirtualHost>

Other important notes: binding to ports below 1024 requires root privileges at bind time, so choose an unprivileged port if your process drops privileges early. Check the web server error log (common locations vary by distribution) for binding or startup errors — the log will show if the server failed to open the new port. Finally, allow the new TCP port through your firewall (ufw, firewalld, iptables) and, on systems with SELinux enabled, add the port to the httpd/http_port_t type.

If those checks still don’t explain it, report (a) the listening sockets output, (b) the exact “Listen” and <VirtualHost> lines you changed, and (c) the tail of the error log — that will point to what’s actually being read at startup.

Recommended Answers

All 3 Replies

Have you restarted Apache? It should read the new configuration then.

Rubberman is right plz restart apache service if its still not working then post the output of following command:

1) netstat -antp
2) ps -aux|grep
3) "apachectl -V" check SERVER_CONFIG_FILE variable and confirm if the file httpd.conf running with is same which/where you are changing port settings


--
Manoj
links deleted by mod

edit /etc/apache2/httpd.conf file and change the port

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.