[users@httpd] problem with redirecting to HTTPS automatically

2017-04-20 Thread Raf Roger
Hi,

i'm using XAMPP on my linux notebook for local dev.
my first step was to create a folder to store my web application and to
check that if user does not use HTTPS, he will be redirected to the same
page but with HTTPS.

i know that it can be done using mod_rewrite but i was not able to make it
works correctly.
In fact, since first page i want to force users to be under HTTPS.

so here is my virtualhost conf file:

  DocumentRoot "/opt/lampp/htdocs/jobportal-admin/"
  ServerName www.jobportal-admin.loc
  ServerAlias jobportal-admin.loc
  ErrorLog "logs/jobportal-admin.loc-error_log"
  CustomLog "logs/jobportal-admin.loc.com-access_log" common
  Options Indexes FollowSymLinks Includes ExecCGI
  DirectoryIndex index.php

   
Options All
AllowOverride All
Require all granted
  



DocumentRoot "/opt/lampp/htdocs/jobportal-admin/"
ServerName www.jobportal-admin.loc
ServerAlias jobportal-admin.loc

Options Indexes FollowSymLinks Includes ExecCGI

DirectoryIndex index.php

SSLEngine on
SSLCertificateFile "/opt/lampp/etc/ssl.crt/server.crt"
SSLCertificateKeyFile "/opt/lampp/etc/ssl.key/server.key"
ErrorLog "logs/jobportal-admin.loc-error_log"
CustomLog "logs/jobportal-admin.loc.com-access_log" common


Options All
AllowOverride All
Require all granted



and in my .htaccess i have the following:

RewriteEngine On

RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www.jobportal-admin\.loc/ [NC]

RewriteRule ^(.*)$ https://www.jobportal-admin.loc/$1 [R,L]

but nothing is redirected to https :(

Any help would be appreciated.
thx a lot.
-- 
Alain
---
Kubuntu 17.04
MySQL 5.6.x
Apache 2.4.7 / OpenSSL 1.0.1c
Tomcat 7.17
PHP 5.6


Re: [users@httpd] Does Apache need to delay startup until system time set?

2017-04-20 Thread Robert Moskowitz

Yehuda,

thanks.  I already learned about chrony-wait for postfix.  I will apply 
it to httpd as well; Roundcubemail will need it...


On 04/20/2017 05:07 PM, Yehuda Katz wrote:
There are some parts of the HTTP conversation which could be affected 
by having the wrong time, but HTTPD itself doesn't care.
For example, if you are using cookies, caching, those could be 
affected by the time change (even more specifically, for PHP sessions, 
when the clock changes, the PHP session cleanup handler might think a 
session is very old and remove it).
If you want to wait for the time to be synchronized, I think you can 
change the systemd unit to require chrony-wait.service 
(https://git.tuxfamily.org/chrony/chrony.git/tree/examples/chrony-wait.service)


- Y

On Thu, Apr 20, 2017 at 4:57 PM, Robert Moskowitz > wrote:


This is for Centos7 on an armv7 SOC with no clock battery.

On startup, Centos runs Chronyd which eventually sets the system
clock.  This can happen really fast, or not depending.  I have
learned that it is NOT a good thing for postfix to start when the
system time is earlier than the build date of postfix.  There is a
way for me to delay postfix start until the time is set.

Does Apache also have this concern not to start until the time is
'fixed'?

thanks


-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org

For additional commands, e-mail: users-h...@httpd.apache.org







Re: [users@httpd] Does Apache need to delay startup until system time set?

2017-04-20 Thread Yehuda Katz
There are some parts of the HTTP conversation which could be affected by
having the wrong time, but HTTPD itself doesn't care.
For example, if you are using cookies, caching, those could be affected by
the time change (even more specifically, for PHP sessions, when the clock
changes, the PHP session cleanup handler might think a session is very old
and remove it).
If you want to wait for the time to be synchronized, I think you can change
the systemd unit to require chrony-wait.service (
https://git.tuxfamily.org/chrony/chrony.git/tree/examples/chrony-wait.service
)

- Y

On Thu, Apr 20, 2017 at 4:57 PM, Robert Moskowitz 
wrote:

> This is for Centos7 on an armv7 SOC with no clock battery.
>
> On startup, Centos runs Chronyd which eventually sets the system clock.
> This can happen really fast, or not depending.  I have learned that it is
> NOT a good thing for postfix to start when the system time is earlier than
> the build date of postfix.  There is a way for me to delay postfix start
> until the time is set.
>
> Does Apache also have this concern not to start until the time is 'fixed'?
>
> thanks
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
>
>


[users@httpd] Does Apache need to delay startup until system time set?

2017-04-20 Thread Robert Moskowitz

This is for Centos7 on an armv7 SOC with no clock battery.

On startup, Centos runs Chronyd which eventually sets the system clock.  
This can happen really fast, or not depending.  I have learned that it 
is NOT a good thing for postfix to start when the system time is earlier 
than the build date of postfix.  There is a way for me to delay postfix 
start until the time is set.


Does Apache also have this concern not to start until the time is 'fixed'?

thanks


-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: [users@httpd] Reg: Custom error message at Apache 2.4.25

2017-04-20 Thread Mike Rumph



On 4/20/2017 4:58 AM, Velmurugan Dhakshnamoorthy wrote:
Thanks Luca for pointing out,  the weblogic module is needed to 
forward request from Apache to weblogic successfully. Is there any 
other way to achieve my requirement?


Regards,
Vel

On Apr 20, 2017 17:20, "Luca Toscano" > wrote:


Hi!

I checked your httpd config and you are using mod_weblogic, not
mod_proxy, so the ProxyErrorOverride option will not be effective :)

Luca

2017-04-20 3:18 GMT+02:00 Velmurugan Dhakshnamoorthy
>:

Hi,
Any help  to identify and correct  what is the issue in my
setting to re-write  the 500 error by Apache Proxy 2.4.25

Regards,
Vel


Hello Vel,

You can try using the ErrorPage directive from mod_weblogic.
- 
http://docs.oracle.com/middleware/12212/webtier/develop-plugin/plugin_params.htm#PLGWL4380 



Mike


Re: [users@httpd] Setup VirtualHost Multiple Domain to SLL Domain.

2017-04-20 Thread js5
If you are redirecting all HTTP -> HTTPS you can do:


  RewriteEngine on
  RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=permanent,L,NE]


This will redirect all requests to your https server

{other redirects can be handled on that}

James



-- 
 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE. 

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



[users@httpd] Setup VirtualHost Multiple Domain to SLL Domain.

2017-04-20 Thread Wilmer Arambula
Hi, I have two domains, domain.web and domain.info, y need redirect to:
https://www.domain.web

http://domain.web  ---> https://www.domain.web
http://www.domain.web   ---> https://www.domain.web
https://domain.web> https://www.domain.web 
http://domain.info   ---> https://www.domain.web
http://www.domain.info   ---> https://www.domain.web
https://domain.info ---> https://www.domain.web
https://www.domain.info  ---> https://www.domain.web

Before asking I read many posts in stackoverflow, serverfault, and I have
managed to build this configuration that works for me correctly, I would
like to know if this is the best way to do it.


ServerName domain.web
ServerAlias www.domain.web www.domain.info domain.info

DocumentRoot /home/domain/public_html

RewriteEngine On

RewriteCond %{SERVER_PORT} 80
RewriteCond %{HTTP_HOST} ^domain\.(info|web) [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain\.(info|web) [NC]
RewriteRule (.*) https://www.domain.web$1 [R=301,L]



ServerName domain.web
ServerAlias www.domain.web www.domain.info domain.info

DocumentRoot /home/domain/public_html

RewriteEngine On

RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} ^domain\.(info|web) [NC,OR]
RewriteCond %{HTTP_HOST} ^www.domain\.(info) [NC]
RewriteRule (.*) https://www.domain.web$1 [R=301,L]


Regards,

-- 


*Wilmer Arambula. *


Re: [users@httpd] Virtual hosts, include php.conf, DirectoryIndex failure

2017-04-20 Thread Luca Toscano
Hi Marc,

+1 to what Rick is saying, if you could avoid mod_php it would be really
better (more info https://wiki.apache.org/httpd/php).

> But when I included the php7.file in the global http.conf or in the
global default-server.conf files then it works!

Sorry for the extra question but are you super sure that you were hitting
the correct Virtual Host while running your tests? I am asking that since
sometimes it may happen to forget about the Host header and hit the default
virtual host instead.

If not, how did you check that DirectoryIndex wasn't working? What request
did you make?

Luca

2017-04-20 14:28 GMT+02:00 Houser, Rick :

> I suggest you remove the php stuff from Apache, switch it over to php-fpm
> (which basically turns it into an appserver).  If you do so, consider
> changing your MPM over to either event or worker at that point.
>
>
> Rick Houser
> Web Administration
>
> > -Original Message-
> > From: Marc Chamberlin [mailto:m...@marcchamberlin.com]
> > Sent: Wednesday, April 19, 2017 15:58
> > To: users@httpd.apache.org
> > Subject: [users@httpd] Virtual hosts, include php.conf, DirectoryIndex
> failure
> >
> > EXTERNAL EMAIL
> >
> >
> > Hi -  While I have a work-around for this issue, I thought I would post
> > it here to see what, if any, feedback I might get. Perhaps I am doing
> > something wrong?  I run a rather complex server environment where I use
> > both Apache HTTPD and Apache Tomcat servers in combination and host a
> > number of virtual hosts (named and all using the same IP address) On one
> > of my virtual hosts I recently installed WordPress and this required me
> > to also add in PHP support, since WordPress uses mostly PHP scripts.
> > Since this is only needed on one of my virtual hosts, I tried to
> > configure just that virtual host to include the additional stuff needed
> > to support PHP. My attempts to do so failed and the workaround was to
> > include the PHP configuration stuff (php7.conf) at a global level that
> > will affect all the virtual hosts that I am supporting. For now, that is
> > OK and won't bother anything but I am wondering why my initial approach
> > failed and if there is something that I am missing or don't understand.
> >
> > Basically, the symptoms, of what happened, was that the DirectoryIndex
> > index.php  setting fails when I just included the php7.conf file in the
> > configuration file for the virtual host. But when I included the
> > php7.file in the global http.conf or in the global default-server.conf
> > files then it works! Error logs do not show anything other than the fact
> > that an index file could not be found when referencing a directory that
> > does indeed have an index.php file in it. I will show the pertinent
> > config files (urls obscured) below in the configuration that fails, and
> > I hope this is not overwhelming. First here is the version info for
> > Apache just so we are all on the same page -
> >
> > httpd -V
> > Server version: Apache/2.4.23 (Linux/SUSE)
> > Server built:   2017-03-22 14:54:04.0 +
> > Server's Module Magic Number: 20120211:61
> > Server loaded:  APR 1.5.1, APR-UTIL 1.5.3
> > Compiled using: APR 1.5.1, APR-UTIL 1.5.3
> > Architecture:   64-bit
> > Server MPM: prefork
> >threaded: no
> >  forked: yes (variable process count)
> > Server compiled with
> >   -D APR_HAS_SENDFILE
> >   -D APR_HAS_MMAP
> >   -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
> >   -D APR_USE_PROC_PTHREAD_SERIALIZE
> >   -D APR_USE_PTHREAD_SERIALIZE
> >   -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
> >   -D APR_HAS_OTHER_CHILD
> >   -D AP_HAVE_RELIABLE_PIPED_LOGS
> >   -D DYNAMIC_MODULE_LIMIT=256
> >   -D HTTPD_ROOT="/srv/www"
> >   -D SUEXEC_BIN="/usr/sbin/suexec"
> >   -D DEFAULT_PIDLOG="/run/httpd.pid"
> >   -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
> >   -D DEFAULT_ERRORLOG="/var/log/apache2/error_log"
> >   -D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
> >   -D SERVER_CONFIG_FILE="/etc/apache2/httpd.conf"
> >
> > 
> >
> > Here is php7.conf that I am including -
> >
> > cat php7.conf
> > 
> > 
> > SetHandler application/x-httpd-php
> > 
> > 
> > SetHandler application/x-httpd-php-source
> > 
> >  DirectoryIndex index.php4
> >  DirectoryIndex index.php5
> >  DirectoryIndex index.php
> > 
> >
> > 
> >
> > And this is my virtual host configuration  (comments removed and URLs
> > obscured)-
> >
> > cat myvirtualhost.conf
> > 
> >  ServerAdmin m...@mydomain.com
> >  ServerName www.myvirtualhost.org
> >  ServerAlias myvirtualhost.org
> >  DocumentRoot "/srv/tomcat/myvirtualhost_webapps/ROOT"
> >  ErrorLog "/var/log/apache2/myvirtualhost.org-error_log"
> >  TransferLog "/var/log/apache2/myvirtualhost.org-access_log"

RE: [users@httpd] Virtual hosts, include php.conf, DirectoryIndex failure

2017-04-20 Thread Houser, Rick
I suggest you remove the php stuff from Apache, switch it over to php-fpm 
(which basically turns it into an appserver).  If you do so, consider changing 
your MPM over to either event or worker at that point. 


Rick Houser
Web Administration

> -Original Message-
> From: Marc Chamberlin [mailto:m...@marcchamberlin.com]
> Sent: Wednesday, April 19, 2017 15:58
> To: users@httpd.apache.org
> Subject: [users@httpd] Virtual hosts, include php.conf, DirectoryIndex failure
> 
> EXTERNAL EMAIL
> 
> 
> Hi -  While I have a work-around for this issue, I thought I would post
> it here to see what, if any, feedback I might get. Perhaps I am doing
> something wrong?  I run a rather complex server environment where I use
> both Apache HTTPD and Apache Tomcat servers in combination and host a
> number of virtual hosts (named and all using the same IP address) On one
> of my virtual hosts I recently installed WordPress and this required me
> to also add in PHP support, since WordPress uses mostly PHP scripts.
> Since this is only needed on one of my virtual hosts, I tried to
> configure just that virtual host to include the additional stuff needed
> to support PHP. My attempts to do so failed and the workaround was to
> include the PHP configuration stuff (php7.conf) at a global level that
> will affect all the virtual hosts that I am supporting. For now, that is
> OK and won't bother anything but I am wondering why my initial approach
> failed and if there is something that I am missing or don't understand.
> 
> Basically, the symptoms, of what happened, was that the DirectoryIndex
> index.php  setting fails when I just included the php7.conf file in the
> configuration file for the virtual host. But when I included the
> php7.file in the global http.conf or in the global default-server.conf
> files then it works! Error logs do not show anything other than the fact
> that an index file could not be found when referencing a directory that
> does indeed have an index.php file in it. I will show the pertinent
> config files (urls obscured) below in the configuration that fails, and
> I hope this is not overwhelming. First here is the version info for
> Apache just so we are all on the same page -
> 
> httpd -V
> Server version: Apache/2.4.23 (Linux/SUSE)
> Server built:   2017-03-22 14:54:04.0 +
> Server's Module Magic Number: 20120211:61
> Server loaded:  APR 1.5.1, APR-UTIL 1.5.3
> Compiled using: APR 1.5.1, APR-UTIL 1.5.3
> Architecture:   64-bit
> Server MPM: prefork
>threaded: no
>  forked: yes (variable process count)
> Server compiled with
>   -D APR_HAS_SENDFILE
>   -D APR_HAS_MMAP
>   -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
>   -D APR_USE_PROC_PTHREAD_SERIALIZE
>   -D APR_USE_PTHREAD_SERIALIZE
>   -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
>   -D APR_HAS_OTHER_CHILD
>   -D AP_HAVE_RELIABLE_PIPED_LOGS
>   -D DYNAMIC_MODULE_LIMIT=256
>   -D HTTPD_ROOT="/srv/www"
>   -D SUEXEC_BIN="/usr/sbin/suexec"
>   -D DEFAULT_PIDLOG="/run/httpd.pid"
>   -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
>   -D DEFAULT_ERRORLOG="/var/log/apache2/error_log"
>   -D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
>   -D SERVER_CONFIG_FILE="/etc/apache2/httpd.conf"
> 
> 
> 
> Here is php7.conf that I am including -
> 
> cat php7.conf
> 
> 
> SetHandler application/x-httpd-php
> 
> 
> SetHandler application/x-httpd-php-source
> 
>  DirectoryIndex index.php4
>  DirectoryIndex index.php5
>  DirectoryIndex index.php
> 
> 
> 
> 
> And this is my virtual host configuration  (comments removed and URLs
> obscured)-
> 
> cat myvirtualhost.conf
> 
>  ServerAdmin m...@mydomain.com
>  ServerName www.myvirtualhost.org
>  ServerAlias myvirtualhost.org
>  DocumentRoot "/srv/tomcat/myvirtualhost_webapps/ROOT"
>  ErrorLog "/var/log/apache2/myvirtualhost.org-error_log"
>  TransferLog "/var/log/apache2/myvirtualhost.org-access_log"
>  HostnameLookups Off
>  UseCanonicalName Off
>  ServerSignature On
>  
> RewriteEngine On
> RewriteCond %{HTTPS} off
> RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
>  
> 
> # THIS INCLUDE STATEMENT AND/OR THE DIRECTIVES IN PHP7.CONF FAILS
> FOR SOME UNKNOWN REASON!
>Include /etc/apache2/conf.d/php7.conf
> 
>  Alias /  /srv/tomcat/myvirtualhost_webapps/ROOT/
>  
>   JkMount / tomcatWorker1
>   JkMount /* tomcatWorker1
>   JkUnMount /*.html tomcatWorker1
>   JkUnMount /*.php tomcatWorker1
>   JkUnMount /*.css tomcatWorker1
>   JkUnMount /*.js tomcatWorker1
>   JkUnMount /*.jpg  tomcatWorker1
>   JkUnMount /*.png  tomcatWorker1
>   JkUnMount /*.gif  tomcatWorker1
>  
>  ScriptAlias 

Re: Re: [users@httpd] Reg: Custom error message at Apache 2.4.25

2017-04-20 Thread Velmurugan Dhakshnamoorthy
Thanks Luca for pointing out,  the weblogic module is needed to forward
request from Apache to weblogic successfully. Is there any other way to
achieve my requirement?

Regards,
Vel

On Apr 20, 2017 17:20, "Luca Toscano"  wrote:

> Hi!
>
> I checked your httpd config and you are using mod_weblogic, not mod_proxy,
> so the ProxyErrorOverride option will not be effective :)
>
> Luca
>
> 2017-04-20 3:18 GMT+02:00 Velmurugan Dhakshnamoorthy :
>
>> Hi,
>> Any help  to identify and correct  what is the issue in my setting to
>> re-write  the 500 error by Apache Proxy 2.4.25
>>
>> Regards,
>> Vel
>> -- Forwarded message --
>> From: "Velmurugan Dhakshnamoorthy" 
>> Date: Apr 18, 2017 16:03
>> Subject: Re: [users@httpd] Reg: Custom error message at Apache 2.4.25
>> To: 
>> Cc:
>>
>> Hi Luca,
>>> Is it possible to pinpoint what is the wrong in my setting. I am still
>>> unable to display the custom error message.
>>>
>>> *The actual message from weblogic 12c in browser*
>>>
>>> Error 500--Internal Server Error
>>> From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
>>> 10.5.1 500 Internal Server Error
>>> The server encountered an unexpected condition which prevented it from
>>> fulfilling the request.
>>>
>>> *Apache Proxy 2.4.25 setting in httpd.conf*
>>>
>>> *Configuration to forward request from Apache to Weblogic 12c*
>>> 
>>>
>>>SetHandler weblogic-handler
>>>WebLogicHost hawley760
>>>   WebLogicPort 8062
>>>Debug ON
>>>WLLogFile /opt/app/bea/apache2.4/httpd-2.4.25/logs/RPS-8060.log
>>>   
>>> 
>>>
>>> *config related to error document in httpd.conf*
>>>
>>> DocumentRoot "/opt/app/bea/apache2.4/httpd-2.4.25/htdocs"
>>> ProxyPreserveHost On
>>> ProxyPass /error !
>>> ProxyErrorOverride On
>>> Alias /error /opt/app/bea/apache2.4/httpd-2.4.25/htdocs
>>> ErrorDocument 500 /error/500.html
>>>
>>> I tried to setup this in virtual host as well, but cannot re-write the
>>> default 500 error message. I am also attaching my httpd.conf file.
>>>
>>> Appreciate if you can tell me what I am doing wrong, it would be much
>>> appreciated.
>>>
>>> Regards,
>>> Vel
>>>
>>>
>>>
>>>
>>>
>>>
>>> Regards,
>>> Velmurugan Dhakshnamoorthy (Vel)
>>> Singapore.
>>>
>>> On Tue, Apr 18, 2017 at 6:56 AM, Velmurugan Dhakshnamoorthy <
>>> dvel@gmail.com> wrote:
>>>
 Thanks again for your valuable inputs,  I am actually restricting
 number of HTTP sessions at weblogic layer,  beyond the specified limit,
  weblogic throws 500 error message,  which is not very useful to users,  I
 want only the 500 error page to be re-written by Apache proxy with simple
 message (ex: server is busy,  login after sometime), I want only 500
 generic error message to re-write,  I don't want to re-write any other
 content from back-end server.

 Regards,
 Vel

 On Apr 18, 2017 00:19, "Luca Toscano"  wrote:

> Hi!
>
> As Nick mentioned there are a couple of options:
>
> 1) https://httpd.apache.org/docs/2.4/mod/mod_substitute.html or
> https://httpd.apache.org/docs/current/mod/mod_proxy_html.html in case
> you want to replace some parts of the response coming from the backend 
> with
> your content.
>
> 2) Write your own content output filter to modify the backend response
> as you wish before flushing it out to the client. I'd suggest to follow
> https://httpd.apache.org/docs/2.4/mod/mod_lua.html#modifying_buckets
> if you want to attempt this road since using Lua instead of C is generally
> easier for people not used to write Apache code.
>
> My personal suggestion is to not use any of the above but to re-think
> about why you want to force the proxy to do this work. A proxy should be 
> as
> lightweight as possible and ideally should mask backend failures with
> pre-defined error pages.
>
> Hope that helps!
>
> Luca
>
> 2017-04-17 9:57 GMT+02:00 Velmurugan Dhakshnamoorthy <
> dvel@gmail.com>:
>
>> Hi Nick,
>> yes exactly,  I want the error message produced by back-end weblogic
>> server to be re-written by Apache proxy and then display custom message 
>> to
>> user.
>>
>> Regards,
>> Vel
>>
>>
>> On Apr 17, 2017 15:34, "Nick Kew"  wrote:
>>
>> On Mon, 2017-04-17 at 09:04 +0800, Velmurugan Dhakshnamoorthy wrote:
>>
>> >
>> > Thanks Luca,  I tried setting proxyerroroverride and error
>> > document  in virtual host, however,  the 500 error produced
>> by
>> > content server is displayed as it is via Apache proxy. Any
>> > further help?
>>
>> Are you saying you want an error message coming from the backend
>> but modified by the proxy?  That would imply using a content filter
>> 

Re: [users@httpd] Best Form Redirect Http --> Https VirtualHost Apache.

2017-04-20 Thread Rainer Canavan
On Thu, Apr 20, 2017 at 2:05 AM, Wilmer Arambula
 wrote:
>
> If that domain points to your servers external IP, it will be handled by the 
> first *:443 virtualhost:
>
> Ok, Perfect thanks a lot for your answer, is there any way to prevent it from 
> redirecting to the first *: 443 virtualhost, without having to define a 
> virtualhost
> for each domain undefined.

You can define one virtual host that handles all requests that do not match any
of your existing virtual hosts. If you define the new wildcard virtual
host in the
correct order, you won't even have to use a ServerAlias with lots of
"*.* *.*.*" etc.

There's a detailed description of how virtualhost matching works at

https://httpd.apache.org/docs/2.4/vhosts/details.html


rainer

-
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org



Re: Re: [users@httpd] Reg: Custom error message at Apache 2.4.25

2017-04-20 Thread Luca Toscano
Hi!

I checked your httpd config and you are using mod_weblogic, not mod_proxy,
so the ProxyErrorOverride option will not be effective :)

Luca

2017-04-20 3:18 GMT+02:00 Velmurugan Dhakshnamoorthy :

> Hi,
> Any help  to identify and correct  what is the issue in my setting to
> re-write  the 500 error by Apache Proxy 2.4.25
>
> Regards,
> Vel
> -- Forwarded message --
> From: "Velmurugan Dhakshnamoorthy" 
> Date: Apr 18, 2017 16:03
> Subject: Re: [users@httpd] Reg: Custom error message at Apache 2.4.25
> To: 
> Cc:
>
> Hi Luca,
>> Is it possible to pinpoint what is the wrong in my setting. I am still
>> unable to display the custom error message.
>>
>> *The actual message from weblogic 12c in browser*
>>
>> Error 500--Internal Server Error
>> From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
>> 10.5.1 500 Internal Server Error
>> The server encountered an unexpected condition which prevented it from
>> fulfilling the request.
>>
>> *Apache Proxy 2.4.25 setting in httpd.conf*
>>
>> *Configuration to forward request from Apache to Weblogic 12c*
>> 
>>
>>SetHandler weblogic-handler
>>WebLogicHost hawley760
>>   WebLogicPort 8062
>>Debug ON
>>WLLogFile /opt/app/bea/apache2.4/httpd-2.4.25/logs/RPS-8060.log
>>   
>> 
>>
>> *config related to error document in httpd.conf*
>>
>> DocumentRoot "/opt/app/bea/apache2.4/httpd-2.4.25/htdocs"
>> ProxyPreserveHost On
>> ProxyPass /error !
>> ProxyErrorOverride On
>> Alias /error /opt/app/bea/apache2.4/httpd-2.4.25/htdocs
>> ErrorDocument 500 /error/500.html
>>
>> I tried to setup this in virtual host as well, but cannot re-write the
>> default 500 error message. I am also attaching my httpd.conf file.
>>
>> Appreciate if you can tell me what I am doing wrong, it would be much
>> appreciated.
>>
>> Regards,
>> Vel
>>
>>
>>
>>
>>
>>
>> Regards,
>> Velmurugan Dhakshnamoorthy (Vel)
>> Singapore.
>>
>> On Tue, Apr 18, 2017 at 6:56 AM, Velmurugan Dhakshnamoorthy <
>> dvel@gmail.com> wrote:
>>
>>> Thanks again for your valuable inputs,  I am actually restricting number
>>> of HTTP sessions at weblogic layer,  beyond the specified limit,  weblogic
>>> throws 500 error message,  which is not very useful to users,  I want only
>>> the 500 error page to be re-written by Apache proxy with simple message
>>> (ex: server is busy,  login after sometime), I want only 500 generic error
>>> message to re-write,  I don't want to re-write any other content from
>>> back-end server.
>>>
>>> Regards,
>>> Vel
>>>
>>> On Apr 18, 2017 00:19, "Luca Toscano"  wrote:
>>>
 Hi!

 As Nick mentioned there are a couple of options:

 1) https://httpd.apache.org/docs/2.4/mod/mod_substitute.html or
 https://httpd.apache.org/docs/current/mod/mod_proxy_html.html in case
 you want to replace some parts of the response coming from the backend with
 your content.

 2) Write your own content output filter to modify the backend response
 as you wish before flushing it out to the client. I'd suggest to follow
 https://httpd.apache.org/docs/2.4/mod/mod_lua.html#modifying_buckets
 if you want to attempt this road since using Lua instead of C is generally
 easier for people not used to write Apache code.

 My personal suggestion is to not use any of the above but to re-think
 about why you want to force the proxy to do this work. A proxy should be as
 lightweight as possible and ideally should mask backend failures with
 pre-defined error pages.

 Hope that helps!

 Luca

 2017-04-17 9:57 GMT+02:00 Velmurugan Dhakshnamoorthy <
 dvel@gmail.com>:

> Hi Nick,
> yes exactly,  I want the error message produced by back-end weblogic
> server to be re-written by Apache proxy and then display custom message to
> user.
>
> Regards,
> Vel
>
>
> On Apr 17, 2017 15:34, "Nick Kew"  wrote:
>
> On Mon, 2017-04-17 at 09:04 +0800, Velmurugan Dhakshnamoorthy wrote:
>
> >
> > Thanks Luca,  I tried setting proxyerroroverride and error
> > document  in virtual host, however,  the 500 error produced
> by
> > content server is displayed as it is via Apache proxy. Any
> > further help?
>
> Are you saying you want an error message coming from the backend
> but modified by the proxy?  That would imply using a content filter
> (such as mod_proxy_html, mod_sed, or mod_substitute) to rewrite
> the response from the backend.
>
> --
> Nick Kew
>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
>
>
>

>>
>
> 

Re: [users@httpd] Help: Apache Crashing Everyday

2017-04-20 Thread Luca Toscano
Hi!

2017-04-19 8:41 GMT+02:00 Jayaram Ponnusamy :

> Hi Luca,
>
> Thanks for the details.
> 1. our server's ulimit values are:
> ]$ ulimit -a
> max user processes  (-u) 1024
>
> Please let me know whether the values are sufficient to allow at least 500
> concurrent connections.
>

To be sure you should check /proc/$pid/limits (where $pid is one of the
Apache processes), but I'd say that your original issue (quoting "and when
the Total Children value is reached 999 the Apache is not responding") is
related to this limit being enforced.


>
> 2. Yes I checked mod_jk log when hang happens, and getting below errors
> continuously.
>
> [Wed Apr 19 02:00:38 2017]loadbalancer www.cmsp1.com 24.843284
> [Wed Apr 19 02:00:38 2017][16313:3878614784 <387%20861%204784>] [info]
> ajp_process_callback::jk_ajp_common.c (1788): Writing to client aborted
> or client network problems
> [Wed Apr 19 02:00:38 2017][16313:3878614784 <387%20861%204784>] [info]
> ajp_service::jk_ajp_common.c (2447): (qu_prod_live_svr1) sending request to
> tomcat failed (unrecoverable), because of client write error (attempt=1)
> [Wed Apr 19 02:00:38 2017][16313:3878614784 <387%20861%204784>] [info]
> service::jk_lb_worker.c (1384): service failed, worker qu_prod_live_svr1 is
> in local error state
> [Wed Apr 19 02:00:38 2017][16313:3878614784 <387%20861%204784>] [info]
> service::jk_lb_worker.c (1403): unrecoverable error 200, request failed.
> Client failed in the middle of request, we can't recover to another
> instance.
> [Wed Apr 19 02:00:38 2017]loadbalancer www.cmsp1.com 19.170901
> [Wed Apr 19 02:00:38 2017][16313:3878614784 <387%20861%204784>] [info]
> jk_handler::mod_jk.c (2608): Aborting connection for worker=loadbalancer
> [Wed Apr 19 02:00:39 2017][16261:3878614784 <387%20861%204784>] [warn]
> map_uri_to_worker_ext::jk_uri_worker_map.c (962): Uri * is invalid. Uri
> must start with /
> [Wed Apr 19 02:00:40 2017][16308:3878614784 <387%20861%204784>] [warn]
> map_uri_to_worker_ext::jk_uri_worker_map.c (962): Uri * is invalid. Uri
> must start with /
>

Was apache asked to reload for logrotation before this? Or did you see an
increase in traffic?


>
> 3. We will upgrade to 2.4.25, could you please share optimal configuration
> for mpm-event to allow more concurrent users, please.
>

I'd suggest to start from https://httpd.apache.org/docs/2.4/mod/event.html,
but every server has its own set of requirements and a proper configuration
needs a bit of testing, so I suggest to set up a fake production
environment first and start playing with 2.4.25 in there first.

Please also check https://httpd.apache.org/docs/current/upgrading.html,
upgrading to 2.4 is not super difficult but you'll might be required to
make some changes to your config.

Hope that helps!

Luca