I'm using Apache 2.4 on Windows and Tomcat 7. Up until now I've been testing everything on my localhost. So my local Apache httpd.conf has this...
<Location /sample>
ProxyPass ajp://localhost:8079/sample
ProxyPassReverse ajp://localhost:8079/sample
</Location>
Now I'm attempting to set Apache up on a different system and point it to my Tomcat system. Here's what the remote Apache httpd.conf has...
<Location /sample>
ProxyPass ajp://192.168.2.93:8079/sample
ProxyPassReverse ajp://192.168.2.93:8079/sample
</Location>
The new Remote Apache is definitely forwarding the request to Tomcat but it's prepending the location to the request. For example...
/sample/sample
When it should be only...
/sample
The only thing that's changed between the local and remote Apache httpd.conf's is I changed the ProxyPass settings from localhost to an IP.
What am I missing here? This is driving me crazy.
Thanks!
Here's my local httpd.conf....
# =================================================
# Modules
# =================================================
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule dir_module modules/mod_dir.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule headers_module modules/mod_headers.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_connect_module modules/mod_proxy_connect.so
LoadModule xml2enc_module modules/mod_xml2enc.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadFile libxml2.dll
LoadModule ssl_module modules/mod_ssl.so
LoadModule proxy_html_module modules/mod_proxy_html.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule substitute_module modules/mod_substitute.so
LoadModule filter_module modules/mod_filter.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule setenvif_module modules/mod_setenvif.so
#LoadModule env_module modules/mod_env.so
Include conf/proxy_html.conf
Include conf/extra/httpd-ssl.conf
# =================================================
# Basic settings
# =================================================
Listen 80
ServerName localhost:80
ServerAdmin fred#www.somedomain.com
UseCanonicalName Off
ServerSignature Off
HostnameLookups Off
ServerTokens Prod
ServerRoot "D:/Apache24"
DocumentRoot "D:/Apache24/htdocs"
<IfModule mod_dir.c>
DirectoryIndex index.html index.htm index.php
</IfModule>
# =================================================
# HTTP and performance settings
# =================================================
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule mpm_winnt.c>
ThreadsPerChild 64
MaxRequestsPerChild 0
</IfModule>
# =================================================
# Logs: emerg, alert, crit, error, warn, notice, info, debug
# =================================================
# Docs ~ http://httpd.apache.org/docs/2.4/mod/core.html#loglevel
LogLevel alert rewrite:trace8 proxy_html:trace7
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
#ErrorLogFormat "[%t] [%l] [pid %P] %F: %E: [client %a] %M"
ErrorLogFormat "[%l] %F ~ %M"
ErrorLog "logs/error.log"
CustomLog "logs/access.log" combined
# =================================================
<VirtualHost *>
ServerName localhost:80
RewriteEngine On
ProxyRequests off
ProxyHTMLEnable Off
<Proxy *>
Require all granted
</Proxy>
<Location /sample>
ProxyPass ajp://localhost:8079/sample
ProxyPassReverse ajp://localhost:8079/sample
</Location>
</VirtualHost>
I don't know why the same exact Apache server (literal copy from one system to another) would produce different URI's because I changed localhost to an IP address. But I got it working by removing the <location/> wrapper from the ProxyPass parameters and using these parameters instead...
ProxyPass /sample ajp://192.168.2.93:8079/sample
ProxyPassReverse /sample ajp://192.168.2.93:8079/sample
Hope this helps someone.
Related
I setup Anything in My Server To Connect To A Domain But I have A Problem Httpd Virtual Host Redirect me To Default Apache Page I don't Know Why I Tried Every Solution On Internet But Nothing works.
Here is My File If Anything Else Needed Tell me:
<VirtualHost *:80>
documentRoot /var/www/buymeacookie.ir/public_html
ServerName buymeacookie.ir
ErrorLog /var/www/buymeacookie.ir/error.log
CustomLog /var/www/buymeacookie.ir/requests.log combined
#Redirect "/" "https://www.buymeacookie.ir/"
</VirtualHost>
I Also Made /var/www/buymeacookie.ir/
and /var/www/buymeacookie.ir/public_html/
and added a index.html on public_html
But When I Open My URL I get Default Page of Apache.
thank you for reading :D
EDIT tree of /var/www is
/var/www
├── buymeacookie.ir
│ ├── access.log
│ ├── error_log
│ ├── error.log
│ ├── public_html
│ │ └── index.html
│ └── requests.log
├── cgi-bin
└── html
this is how I would configure such a site. The requirements I figure out from your question:
domain: www.example.com and example.com
the files for this domain are in /var/www/example.com/public_html/
that domain is setup as a VirtualHost, with separated logs for this domain
IMPORTANT: there are no other VirtualHosts for port 80
the top directory for Apache will be /opt/apache
logs will end up in /opt/apache/logs
default content files are in /opt/apache/htdocs
/var/www/example.com/public_html/ must be owned by user httpd, group httpd, permissions 750
if owned by another user, the permissions should be 755, but this is less secure
modules must be added or removed according to your requirements
obviously, you must adjust the directories according to your system
/opt/apache/conf/httpd.conf
ServerRoot "/opt/apache"
Listen 80
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule filter_module modules/mod_filter.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule headers_module modules/mod_headers.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
LoadModule unixd_module modules/mod_unixd.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule dir_module modules/mod_dir.so
<IfModule unixd_module>
User httpd
Group httpd
</IfModule>
ServerName example.com:80
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "/opt/apache/htdocs"
<Directory "/opt/apache/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
ErrorLog "logs/error_log"
LogLevel debug
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "logs/access_log" combined
</IfModule>
<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
</IfModule>
Include conf/extra/httpd-mpm.conf
Include conf/extra/httpd-vhosts.conf
Include conf/extra/httpd-default.conf
/opt/apache/conf/extra/httpd-vhosts.conf
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ServerAdmin misc#example.com
LogLevel debug
ErrorLog "logs/example.com_error_log"
CustomLog "logs/example.com_access_log" combined
DocumentRoot "/var/www/example.com/public_html/"
<Directory "/var/www/example.com/public_html/">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
DirectoryIndex index.html
</VirtualHost>
With this setup:
if you call http://www.example.com or http://example.com, the files will come from /var/www/example.com/public_html/
logs under /opt/apache/logs will indicate the start of the httpd
logs /opt/apache/logs/example.com_*_log will show the transactions and/or errors from your tests
Obviously, this is a starting point, you must adjust for your other requirements.
Line 2 of your .conf file is wrong: must be DocumentRoot, and not documentRoot
Background: I am running Apache 2.4.25 on RHEL 7. An existing web site has existed for years, and now I am wanting to add an additional unrelated web site running Angular.
Primary issue: No matter what I do, I am unable to route traffic to the new web site.
Expected behavior: Existing site continues to function on 8443, and the new site functions on 10443.
Actual behavior: Existing site listens on 8443 and 10443, but new site returns a 404 on both.
File system locations:
Apache server: /opt/intapache/
Existing (functional) site: /opt/cspgateway/
New (non-functional) site: /opt/intapache/htdocs/ (Note: index.html in this directory is set to 755 file access)
Current files: http.conf points to a second conf
httpd.conf:
ServerRoot "/opt/intapache/"
Listen 8443
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule socache_dbm_module modules/mod_socache_dbm.so
LoadModule socache_memcache_module modules/mod_socache_memcache.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule filter_module modules/mod_filter.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule headers_module modules/mod_headers.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule unixd_module modules/mod_unixd.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule dir_module modules/mod_dir.so
LoadModule alias_module modules/mod_alias.so
<IfModule unixd_module>
User cachedb
Group cachedb
</IfModule>
ServerAdmin you#example.com
ServerName example.com
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "/opt/cspgateway/csp"
<Directory "/opt/cspgateway/csp">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<Files ".ht*">
Require all denied
</Files>
ErrorLog "logs/error_log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "logs/access_log" common
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/opt/intapache//cgi-bin/"
</IfModule>
<IfModule cgid_module>
</IfModule>
<Directory "/opt/intapache/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule headers_module>
RequestHeader unset Proxy early
</IfModule>
<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
</IfModule>
<IfModule proxy_html_module>
Include conf/extra/proxy-html.conf
</IfModule>
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
Include conf/extra/cspgateway.conf
cspgateway.conf
<VirtualHost *:8443>
DocumentRoot /opt/cspgateway/csp
ServerName example.com
SSLEngine on
SSLCertificateFile "/opt/example.crt"
SSLCertificateKeyFile "/opt/example.key"
SSLCertificateChainFile "/opt/chaincert.crt"
SSLProtocol All -SSLv2 -SSLv3 +TLSv1.2
</VirtualHost>
Listen 10443
<VirtualHost *:10443>
DocumentRoot /opt/intapache/htdocs
ServerName example.com
SSLEngine on
SSLCertificateFile "/opt/example.crt"
SSLCertificateKeyFile "/opt/example.key"
SSLCertificateChainFile "/opt/chaincert.crt"
SSLProtocol All -SSLv2 -SSLv3 +TLSv1.2
<Directory "/opt/intapache/htdocs">
AllowOverride None
Options Indexes FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
LoadModule csp_module_sa /opt/cspgateway/bin/CSPa24.so
CSPModulePath /opt/cspgateway/bin/
<Location "/csp/bin/Systems/">
SetHandler cspsys-handler-sa
</Location>
<Location "/csp/bin/RunTime/">
SetHandler csp-handler-sa
</Location>
<Location />
CSP On
</Location>
CSPFileTypes csp cls zen cxw gif jpeg jpg jpe png sgi svg svgz tiff tif ico
Alias /csp/ /opt/cspgateway/csp/
<Directory "/opt/cspgateway/csp">
AllowOverride None
Options MultiViews FollowSymLinks ExecCGI
Order allow,deny
Allow from all
<FilesMatch "\.(log|ini|pid|exe)$">
Deny from all
</FilesMatch>
</Directory>
## START SDS-POC CONFIG ##
<Directory "/opt/intapache/htdocs">
AllowOverride None
Options MultiViews FollowSymLinks ExecCGI
Require all granted
</Directory>
## END SDS-POC CONFIG ##
SSLSessionCache "shmcb:logs/ssl_scache(512000)"
With the limited information provided I built this configuration.
httpd.conf
ServerRoot "/opt/intapache/"
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule socache_dbm_module modules/mod_socache_dbm.so
LoadModule socache_memcache_module modules/mod_socache_memcache.so
LoadModule reqtimeout_module modules/mod_reqtimeout.so
LoadModule filter_module modules/mod_filter.so
LoadModule mime_module modules/mod_mime.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule env_module modules/mod_env.so
LoadModule headers_module modules/mod_headers.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule unixd_module modules/mod_unixd.so
LoadModule status_module modules/mod_status.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule dir_module modules/mod_dir.so
LoadModule alias_module modules/mod_alias.so
<IfModule unixd_module>
User cachedb
Group cachedb
</IfModule>
ServerAdmin you#example.com
<Directory />
AllowOverride none
Require all denied
</Directory>
<Files ".ht*">
Require all denied
</Files>
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/opt/intapache//cgi-bin/"
</IfModule>
<IfModule cgid_module>
</IfModule>
<Directory "/opt/intapache/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule headers_module>
RequestHeader unset Proxy early
</IfModule>
<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
</IfModule>
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
SSLSessionCache "shmcb:logs/ssl_scache(512000)"
</IfModule>
Include conf/extra/cspgateway.conf
conf/extra/cspgateway.conf
Listen 8443
<VirtualHost *:8443>
ServerName OLD-example.com
CustomLog "logs/8443_access_log" combined
ErrorLog "logs/8443_error_log"
LogLeval debug
SSLEngine on
SSLCertificateFile "/opt/OLD-example.crt"
SSLCertificateKeyFile "/opt/OLD-example.key"
SSLCertificateChainFile "/opt/OLD-chaincert.crt"
SSLProtocol All -SSLv2 -SSLv3 +TLSv1.2
DirectoryIndex index.html
LoadModule csp_module_sa /opt/cspgateway/bin/CSPa24.so
CSPModulePath /opt/cspgateway/bin/
<Location />
CSP On
</Location>
<Location "/csp/bin/Systems/">
SetHandler cspsys-handler-sa
</Location>
<Location "/csp/bin/RunTime/">
SetHandler csp-handler-sa
</Location>
CSPFileTypes csp cls zen cxw gif jpeg jpg jpe png sgi svg svgz tiff tif ico
DocumentRoot "/opt/cspgateway/csp"
Alias /csp/ /opt/cspgateway/csp/
<Directory "/opt/cspgateway/csp">
AllowOverride None
Options MultiViews FollowSymLinks ExecCGI
Order allow,deny
Allow from all
<FilesMatch "\.(log|ini|pid|exe)$">
Deny from all
</FilesMatch>
</Directory>
</VirtualHost>
Listen 10443
<VirtualHost *:10443>
ServerName NEW-example.com
CustomLog "logs/10443_access_log" combined
ErrorLog "logs/10443_error_log"
LogLeval debug
SSLEngine on
SSLCertificateFile "/opt/NEW-example.crt"
SSLCertificateKeyFile "/opt/NEW-example.key"
SSLCertificateChainFile "/opt/NEW-chaincert.crt"
SSLProtocol All -SSLv2 -SSLv3 +TLSv1.2
DocumentRoot /opt/intapache/htdocs
<Directory "/opt/intapache/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
DirectoryIndex index.html
</VirtualHost>
What was done
Split both sites, each in a separate VirtualHost.
Split the log files, one for each VirtualHost. This helps debug what is going on with each site. I also set LogLevel debug for now, you should set it back to something less verbose once you have something working.
Set different certificates for SSL. This can be undone if you really want both sites to have the same domain name. It is possible here since you use different ports.
All configuration related to each site is contained within it's proper VirtualHost. ex. directories, or the CSP module. I have a hunch that since this module was loaded in the generic section before, it was activated on both connections to 8443 and 10443. From what I understand, it should only be active on connections to 8443, which I did here.
Only 8443 has options Options MultiViews FollowSymLinks ExecCGI. For 10443, it uses the "regular" options for serving html pages and their resources.
SSLSessionCache was moved to httpd.conf, since this is a generic directive.
I removed this directive: Include conf/extra/proxy-html.conf. No loaded module, no directive.
Doing it this way ensures each site is separate from the other. Although I do not know what CSP does, I guess it should not be active for both sites, therefore it was moved into the 8443 VirtualHost.
Last point, ports 8443 and 10443 should be open on the server to allow clients to connect to them.
If that does not work, please start a new question and include:
configuration files
log entries
expected behavior
current behavior
as much details as you can include!
I have a web application (java, jsp)running on tomcat 7 . It runs perfectly fine when i do http://localhost.somedomain.com/
i want to enable SSL so that i can access my site https://localhost.somedomain.com/
I have installed self signed certificate and configured httpd.conf ( on apache)
by following the steps as explained in
https://getgrav.org/blog/mac-os-x-apache-setup-ssl
when i access https://localhost.somedomain.com/ it seems to look for index.html to serve . i added a dummy index.html in root of my web application and it gets served. It seems to serve as static file than rendering it as a web application(executing the controller as done by the http version ). When i access https://localhost.somedomain.com/url/ it reports a 404 /url/ not found
My first question is ,
do i need to do any configuration to tomcat (server.xml) in addition to changes in httpd.conf (apache)
My second question is ,
in httpd.conf i have given the document root as the folder where the webapplication is deployed to (/apps/sstp/tomcat/webapps/ROOT) , Is this correct? my httpd.conf entry is as below
my httpd.conf file is as below
ServerRoot "/usr"
Listen 80
Listen 443
LoadModule authn_file_module libexec/apache2/mod_authn_file.so
LoadModule authn_core_module libexec/apache2/mod_authn_core.so
LoadModule authz_host_module libexec/apache2/mod_authz_host.so
LoadModule authz_groupfile_module libexec/apache2/mod_authz_groupfile.so
LoadModule authz_user_module libexec/apache2/mod_authz_user.so
LoadModule authz_core_module libexec/apache2/mod_authz_core.so
LoadModule access_compat_module libexec/apache2/mod_access_compat.so
LoadModule auth_basic_module libexec/apache2/mod_auth_basic.so
LoadModule socache_shmcb_module libexec/apache2/mod_socache_shmcb.so
LoadModule reqtimeout_module libexec/apache2/mod_reqtimeout.so
LoadModule filter_module libexec/apache2/mod_filter.so
LoadModule mime_module libexec/apache2/mod_mime.so
LoadModule log_config_module libexec/apache2/mod_log_config.so
LoadModule env_module libexec/apache2/mod_env.so
LoadModule headers_module libexec/apache2/mod_headers.so
LoadModule setenvif_module libexec/apache2/mod_setenvif.so
LoadModule version_module libexec/apache2/mod_version.so
LoadModule proxy_module libexec/apache2/mod_proxy.so
LoadModule proxy_connect_module libexec/apache2/mod_proxy_connect.so
LoadModule proxy_ftp_module libexec/apache2/mod_proxy_ftp.so
LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so
LoadModule proxy_fcgi_module libexec/apache2/mod_proxy_fcgi.so
LoadModule proxy_scgi_module libexec/apache2/mod_proxy_scgi.so
LoadModule proxy_wstunnel_module libexec/apache2/mod_proxy_wstunnel.so
LoadModule proxy_ajp_module libexec/apache2/mod_proxy_ajp.so
LoadModule proxy_balancer_module libexec/apache2/mod_proxy_balancer.so
LoadModule proxy_express_module libexec/apache2/mod_proxy_express.so
LoadModule slotmem_shm_module libexec/apache2/mod_slotmem_shm.so
LoadModule ssl_module libexec/apache2/mod_ssl.so
LoadModule lbmethod_byrequests_module libexec/apache2/mod_lbmethod_byrequests.so
LoadModule lbmethod_bytraffic_module libexec/apache2/mod_lbmethod_bytraffic.so
LoadModule lbmethod_bybusyness_module libexec/apache2/mod_lbmethod_bybusyness.so
LoadModule unixd_module libexec/apache2/mod_unixd.so
LoadModule status_module libexec/apache2/mod_status.so
LoadModule autoindex_module libexec/apache2/mod_autoindex.so
LoadModule negotiation_module libexec/apache2/mod_negotiation.so
LoadModule dir_module libexec/apache2/mod_dir.so
LoadModule alias_module libexec/apache2/mod_alias.so
LoadModule hfs_apple_module libexec/apache2/mod_hfs_apple.so
<IfModule unixd_module>
User _www
Group _www
</IfModule>
ServerAdmin you#example.com
ServerName localhost.somedomain.com
<Directory />
AllowOverride All
Require all granted
</Directory>
DocumentRoot "/apps/sstp/tomcat/webapps/ROOT"
<Directory "/apps/sstp/tomcat/webapps/ROOT">
Require all granted
Options Includes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<FilesMatch "^\.([Hh][Tt]|[Dd][Ss]_[Ss])">
Require all denied
</FilesMatch>
<Files "rsrc">
Require all denied
</Files>
<DirectoryMatch ".*\.\.namedfork">
Require all denied
</DirectoryMatch>
ErrorLog "/private/var/log/apache2/error_log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
# You need to enable mod_logio.c to use %I and %O
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "/private/var/log/apache2/access_log" common
</IfModule>
<IfModule alias_module>
ScriptAliasMatch ^/cgi-bin/((?!(?i:webobjects)).*$) "/Library/WebServer/CGI-Executables/$1"
</IfModule>
<IfModule cgid_module>
</IfModule>
<Directory "/Library/WebServer/CGI-Executables">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule mime_module>
TypesConfig /private/etc/apache2/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
</IfModule>
TraceEnable off
Include /private/etc/apache2/extra/httpd-mpm.conf
Include /private/etc/apache2/extra/httpd-autoindex.conf
Include /private/etc/apache2/extra/httpd-vhosts.conf
<IfModule proxy_html_module>
Include /private/etc/apache2/extra/proxy-html.conf
</IfModule>
Include /private/etc/apache2/extra/httpd-ssl.conf
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
Include /private/etc/apache2/other/*.conf
my httpd-vhosts.conf is as below
<VirtualHost *:443>
ServerAdmin a#b.com
DocumentRoot "/apps/sstp/tomcat/webapps/ROOT"
ServerName localhost.somedomain.com
SSLEngine on
SSLCertificateFile "/private/etc/apache2/server.crt"
SSLCertificateKeyFile "/private/etc/apache2/server.key"
</VirtualHost>
my httpd-ssl.conf is as below
Listen 443
SSLCipherSuite HIGH:MEDIUM:!MD5:!RC4
SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4
SSLHonorCipherOrder on
SSLProtocol all -SSLv3
SSLProxyProtocol all -SSLv3
SSLPassPhraseDialog builtin
SSLSessionCache "shmcb:/private/var/run/ssl_scache(512000)"
SSLSessionCacheTimeout 300
<VirtualHost *:443>
DocumentRoot "/apps/sstp/tomcat/webapps/ROOT"
ServerName localhost.somedomain.com
ErrorLog "/private/var/log/apache2/error_log"
TransferLog "/private/var/log/apache2/access_log"
SSLEngine on
SSLCertificateFile "/private/etc/apache2/server.crt"
SSLCertificateKeyFile "/private/etc/apache2/server.key"
<FilesMatch "\.(cgi|shtml|phtml|php)$">
SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/Library/WebServer/CGI-Executables">
SSLOptions +StdEnvVars
</Directory>
BrowserMatch "MSIE [2-5]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
CustomLog "/private/var/log/apache2/ssl_request_log" \
"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>
my tomcat server.xml is as below
<?xml version='1.0' encoding='utf-8'?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/>
<Listener className="org.apache.catalina.core.JasperListener"/>
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
<GlobalNamingResources>
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
address="127.0.0.1"
maxThreads="1500"
acceptCount="100"
secure="#tomcat.session.secure#"/>
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
<Engine name="Catalina" defaultHost="localhost">
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context docBase="/apps/sstp/tomcat/html" path="/info"/>
</Host>
</Engine>
</Service>
</Server>
In very simple words i want to configure whatever is needed to make my application running as http://localhost.somedomain.com to run over ssl as https://localhost.somedomain.com
This is missing in httpd-vhosts.conf
ProxyPreserveHost On
ProxyPass / ajp://localhost:8009/
ProxyPassReverse / ajp://localhost:8009/
Because of this, request is not routed from apache to tomcat
By the description in your question I read that you set up SSL on the apache and want to pass the requests to tomcat using the AJP-protocol. In that case you should not specify the DocumentRoot of your VirtualHost to be some tomcat-directory but you should instead specify the correct JkMount (if you are using mod_jk) or ProxyPass (if you are using mod_proxy_ajp) directives. Take a look at the configuration of your virtual host on port 80, it should contain the correct statements and you could just copy them over to your SSL-virtualHost.
I have been working to get multi tenancy running on same port on same ip address. I have achieved the objective with different ports but I can't run the same on one port only.
Here the apache web server redirects the request to weblogic host on same machine.
I have gone through multiple guides but it is not working as expected. I have configured two virtual hosts for same port with URL as localhost:9010/site1 and localhost:9010/site2. The configuration in httpd.conf is mentioned below. I don't know where I have made the mistake so I have kept whole configuration file.
Define SRVROOT "D:\Apache24"
ServerRoot "${SRVROOT}"
Listen 9010
#Listen 9011
LoadModule actions_module modules/mod_actions.so
LoadModule alias_module modules/mod_alias.so
LoadModule allowmethods_module modules/mod_allowmethods.so
LoadModule asis_module modules/mod_asis.so
LoadModule auth_basic_module modules/mod_auth_basic.so
LoadModule authn_core_module modules/mod_authn_core.so
LoadModule authn_file_module modules/mod_authn_file.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule authz_user_module modules/mod_authz_user.so
LoadModule autoindex_module modules/mod_autoindex.so
LoadModule cgi_module modules/mod_cgi.so
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule headers_module modules/mod_headers.so
LoadModule include_module modules/mod_include.so
LoadModule isapi_module modules/mod_isapi.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule negotiation_module modules/mod_negotiation.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_html_module modules/mod_proxy_html.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
LoadModule ssl_module modules/mod_ssl.so
LoadModule xml2enc_module modules/mod_xml2enc.so
<IfModule unixd_module>
User daemon
Group daemon
</IfModule>
<Directory />
AllowOverride ALL
Require all granted
</Directory>
DocumentRoot "${SRVROOT}/htdocs"
<Directory "${SRVROOT}/htdocs">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex /home
</IfModule>
<Files ".ht*">
Require all denied
</Files>
ErrorLog "logs/error.log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "logs/access.log" common
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "${SRVROOT}/cgi-bin/"
</IfModule>
<IfModule cgid_module>
</IfModule>
<Directory "${SRVROOT}/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule mime_module>
TypesConfig conf/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/css .css
AddType text/javascript .js
</IfModule>
<IfModule proxy_html_module>
Include conf/extra/httpd-proxy-html.conf
</IfModule>
<IfModule ssl_module>
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
</IfModule>
ProxyRequests on
ProxyIOBufferSize 65536
SSLProxyEngine on
ErrorDocument 403 /home
ErrorDocument 404 /home
NameVirtualHost *:9010
<VirtualHost *:9010>
ServerName localhost:9010/site2
LogLevel info
<Location />
SetHandler weblogic-handler
</Location>
ProxyPass /site2 http://localhost:7001
ProxyPassReverse /site2 http://localhost:7001
ProxyPass /Login.zul http://localhost:7001/Login.zul
ProxyPassReverse /Login.zul http://localhost:7001/Login.zul
<IfModule mod_weblogic.c>
WebLogichost localhost
WebLogicPort 7001
debug OFF
FileCaching OFF
MatchExpression *
KeepAliveSecs 540
</IfModule>
</VirtualHost>
<VirtualHost localhost:9010>
ServerName localhost:9010/site1
LogLevel info
<Location />
SetHandler weblogic-handler
</Location>
ProxyPass /site1 http://localhost:7001
ProxyPassReverse /site1 http://localhost:7001
ProxyPass /Login.zul http://localhost:7001/Login.zul
ProxyPassReverse /Login.zul http://localhost:7001/Login.zul
<IfModule mod_weblogic.c>
WebLogichost localhost
WebLogicPort 7001
debug OFF
FileCaching OFF
MatchExpression *
KeepAliveSecs 540
</IfModule>
</VirtualHost>
Whenever I use different ports for site1 and site2, it runs fine. But keeping the same port does not work for me. Only the virtualhost defined first works and the other returns eorro 404.
Also I found that it is called as Name based virtual hosting. The guides suggests that NameVirtualHost directive should be configured. I have also added the same.
Please help... Thank you in advance..
If you are running 2 VirtualHosts on the same port, the differentiator would be the Servername, such as:
<VirtualHost *:9010>
ServerName site1.localhost.local
......
</VirtualHost>
<VirtualHost *:9010>
ServerName site2.localhost.local
......
</VirtualHost>
In your examples you are using subdirectory as you servername and this is not work, that seems to be the issue
I have a Pyramid app and apache with mod_wsgi and I'm trying to make them work together. Here is my httpd.conf:
ServerRoot "/home/user/webapps/myapp/apache2"
LoadModule dir_module modules/mod_dir.so
LoadModule env_module modules/mod_env.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule wsgi_module modules/mod_wsgi.so
LoadModule authz_host_module modules/mod_authz_host.so
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combinedCustomLog /home/user/logs/user/access_myapp.log combined
ErrorLog /home/user/logs/user/error_myapp.log
KeepAlive Off
Listen 41121
MaxSpareThreads 3
MinSpareThreads 1
ServerLimit 1
SetEnvIf X-Forwarded-SSL on HTTPS=1
ThreadsPerChild 5
WSGIApplicationGroup %{GLOBAL}
WSGIPassAuthorization On
WSGIDaemonProcess myapp processes=1 display-name=%{GROUP} python-path=/home/user/webapps/myapp/htdocs/lib/python2.4/site-packages/ threads=4
WSGIScriptAlias / /home/user/webapps/myapp/htdocs/pyramid.wsgi
<Directory /home/user/webapps/myapp/htdocs>
WSGIProcessGroup myapp
Order allow,deny
Allow from all
</Directory>
Unfortunately, I get a server error: AssertionError: The EvalException middleware is not usable in a multi-process environment
I followed this tutorial and looked at this post, but couldn't really make anything of it.
Thanks!
Remove the 'processes=1' option from WSGIDaemonProcess. Ie., let it default to a single process and don't set it explicitly. Any use of 'processes' option will cause 'wsgi.multiprocess' to be set to True which isn't what you want. See documentation for 'processes' option in:
http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDaemonProcess
You must disable debug mode in yours deployment settings