This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Weird .htaccess behavior
#8
RE: Weird .htaccess behavior
Are all your sites https? If so this would be a bug. Although there is no reason I can figure why somebody would code it to remove the listen 80 for any reason as that is the core port for any web server. I'll look into the code and check it out.

This is the relevant code to the Listen 80/Listen anything:
Code:
   $VHostDefaultPort = ctrl_options::GetSystemOption('apache_port');
   $customPorts = array(ctrl_options::GetSystemOption('sentora_port'));
   $portQuery = $zdbh->prepare("SELECT vh_custom_port_in FROM x_vhosts WHERE vh_deleted_ts IS NULL");
   $portQuery->execute();
   while ($rowport = $portQuery->fetch()) {
       $customPorts[] = (empty($rowport['vh_custom_port_in'])) ? $VHostDefaultPort : $rowport['vh_custom_port_in'];
   }
   $customPortList = array_unique($customPorts);

--[snip]--

   # NameVirtualHost is still needed for Apache 2.2 but must be removed for apache 2.3
   if ((double) sys_versions::ShowApacheVersion() < 2.3) {
       foreach ($customPortList as $port) {
           $line .= "NameVirtualHost *:" . $port . fs_filehandler::NewLine();
       }
   }

   # Listen is mandatory for each port <> 80 (80 is defined in system config)
   foreach ($customPortList as $port) {
       $line .= "Listen " . $port . fs_filehandler::NewLine();
   }


So, if you changed the default Apache Service Port (row 80 in DB x_settings) from 80 to anything else (443?), that would cause it to not re-create a Listen 80. This must stay at port 80 and use custom vhost entry port-forwards to use any other ports.

That is the only way I can see it not reproducing the Listen 80.

After even further review, if I am reading this right, this would remove port 80 from the list if any custom ports exist:
Code:
  while ($rowport = $portQuery->fetch()) {
      $customPorts[] = (empty($rowport['vh_custom_port_in'])) ? $VHostDefaultPort : $rowport['vh_custom_port_in'];
  }
  $customPortList = array_unique($customPorts);

I think it should be something like:
Code:
  while ($rowport = $portQuery->fetch()) {
      $customPorts[] = (empty($rowport['vh_custom_port_in'])) ? $VHostDefaultPort : $rowport['vh_custom_port_in'];
  }
  $customPorts = array_push($customPorts, $VHostDefaultPort); // Adds the default Apache Port
  $customPortList = array_unique($customPorts);
Not yet tested.
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:


Messages In This Thread
Weird .htaccess behavior - by worksmarter - 05-04-2017, 12:47 PM
RE: Weird .htaccess behavior - by TGates - 05-05-2017, 02:53 AM
RE: Weird .htaccess behavior - by worksmarter - 05-05-2017, 06:53 AM
RE: Weird .htaccess behavior - by TGates - 05-05-2017, 02:07 PM
RE: Weird .htaccess behavior - by worksmarter - 05-05-2017, 02:23 PM
RE: Weird .htaccess behavior - by TGates - 05-05-2017, 04:06 PM
RE: Weird .htaccess behavior - by worksmarter - 05-05-2017, 04:29 PM
RE: Weird .htaccess behavior - by TGates - 05-06-2017, 02:41 AM
RE: Weird .htaccess behavior - by worksmarter - 05-06-2017, 09:01 AM
RE: Weird .htaccess behavior - by TGates - 05-06-2017, 11:55 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Global .htaccess for Sentora and/or Apache rsthomas 2 5 ,668 01-13-2020, 06:52 AM
Last Post: Vedran B
.htaccess has stopped working? tbrady85 2 6 ,619 09-08-2017, 01:56 AM
Last Post: TGates
unexpected vhost/ssl behavior worksmarter 5 11 ,402 03-10-2017, 08:05 AM
Last Post: TGates

Forum Jump:


Users browsing this thread: 2 Guest(s)