Resetting the port number

Depending on how your web server was set up (manual build or automatic configuration from server panel managers, such as cPanel or Plesk), you may find yourself with a lot of configuration files to edit. The main configuration file is often found in /etc/httpd/conf/ or /etc/apache2/, and there might be more, depending on how your configuration is structured. Some server panel managers create extra configuration files for each virtual host.

There are three main elements you need to replace in your Apache configuration:

  • The Listen directive is set to listen on port 80 by default. You will have to replace that port with another, such as 8080. This directive is usually found in the main configuration file, but on some setups the directive appears in a separate file called ports.conf.
  • You must make sure that the following configuration directive is present in the main configuration file: NameVirtualHost A.B.C.D:8080, where A.B.C.D is the IP address of the main network interface which server communications go through.
  • The port you just selected needs to be reported in all your virtual host configuration sections.

The virtual host sections must be transformed from the following template:

<VirtualHost A.B.C.D:80> 
  ServerName   example.com  
  ServerAlias  www.example.com 
  [...] 
</VirtualHost> 

They should be transformed to the following:

<VirtualHost A.B.C.D:8080> 
  ServerName   example.com:8080 
  ServerAlias  www.example.com 
  [...] 
</VirtualHost> 

In this example, A.B.C.D is the IP address of the virtual host and example.com is the virtual host's name. The port must be edited on the first two lines.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.205.228