Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Aurélien Vermylen
slapos
Commits
4956c213
Commit
4956c213
authored
May 16, 2012
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'apache'
parents
f7bbd22a
116783d9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
18 deletions
+23
-18
slapos/recipe/apache_frontend/__init__.py
slapos/recipe/apache_frontend/__init__.py
+6
-10
slapos/recipe/apache_frontend/template/apache.conf.in
slapos/recipe/apache_frontend/template/apache.conf.in
+17
-8
No files found.
slapos/recipe/apache_frontend/__init__.py
View file @
4956c213
...
...
@@ -71,18 +71,12 @@ class Recipe(BaseSlapRecipe):
slave_dict
=
{}
service_dict
=
{}
# Check if default port
if
frontend_port_number
is
443
or
frontend_port_number
is
80
:
port_snippet
=
""
else
:
port_snippet
=
":%s"
%
frontend_port_number
for
slave_instance
in
slave_instance_list
:
backend_url
=
slave_instance
.
get
(
"url"
,
None
)
reference
=
slave_instance
.
get
(
"slave_reference"
)
# Set scheme (http? https?)
# Future work may allow to choose between http and https (or both?)
scheme
=
'http
s
://'
scheme
=
'http://'
self
.
logger
.
info
(
'processing slave instance: %s'
%
reference
)
...
...
@@ -93,10 +87,12 @@ class Recipe(BaseSlapRecipe):
continue
# Check for custom domain (like mypersonaldomain.com)
# If no custom domain, use generated one
# If no custom domain, use generated one
.
domain
=
slave_instance
.
get
(
'custom_domain'
,
"%s.%s"
%
(
reference
.
replace
(
"-"
,
""
).
lower
(),
frontend_domain_name
))
slave_dict
[
reference
]
=
"%s%s%s/"
%
(
scheme
,
domain
,
port_snippet
)
# Define the URL where the instance will be available
# WARNING: we use default ports (443, 80) here.
slave_dict
[
reference
]
=
"%s%s/"
%
(
scheme
,
domain
)
# Check if we want varnish+stunnel cache.
if
slave_instance
.
get
(
"enable_cache"
,
""
).
upper
()
in
(
'1'
,
'TRUE'
):
...
...
@@ -455,7 +451,7 @@ class Recipe(BaseSlapRecipe):
return
stunnel_conf
def
installFrontendApache
(
self
,
ip_list
,
key
,
certificate
,
name
,
port
,
plain_http_port
=
8080
,
port
=
4443
,
plain_http_port
=
8080
,
rewrite_rule_list
=
[],
rewrite_rule_zope_list
=
[],
access_control_string
=
None
):
# Create htdocs, populate it with default 404 document
...
...
slapos/recipe/apache_frontend/template/apache.conf.in
View file @
4956c213
...
...
@@ -34,6 +34,7 @@ CustomLog "%(access_log)s" common
#LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule deflate_module modules/mod_deflate.so
LoadModule setenvif_module modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so
...
...
@@ -89,19 +90,12 @@ Header append Vary User-Agent
# SSL Configuration
%(ssl_snippet)s
# Dummy virtualhost redirecting to https. Note: will work only if https listens
# on standard port (443)
<VirtualHost *:%(plain_http_port)s>
RewriteEngine On
# Not using HTTPS? Ask that guy over there.
RewriteRule ^/(.*)$ https://%%{SERVER_NAME}%%{REQUEST_URI}
</VirtualHost>
<VirtualHost *:%(https_port)s>
SSLEngine on
SSLProxyEngine on
# Rewrite part
ProxyVia On
ProxyPreserveHost On
ProxyTimeout 600
RewriteEngine On
...
...
@@ -122,6 +116,21 @@ Header append Vary User-Agent
ErrorDocument 404 /notfound.html
</VirtualHost>
<VirtualHost *:%(plain_http_port)s>
RewriteEngine On
ProxyPreserveHost On
# We accept generic (i.e not lamp) backends on http
RewriteMap apachemapgeneric txt:%(apachemap_path)s
RewriteCond ${apachemapgeneric:%%{SERVER_NAME}} >""
RewriteRule ^/(.*)$ ${apachemapgeneric:%%{SERVER_NAME}}/$1 [L,P]
# Not using HTTPS? Ask that guy over there.
# Dummy redirection to https. Note: will work only if https listens
# on standard port (443).
RewriteRule ^/(.*)$ https://%%{SERVER_NAME}%%{REQUEST_URI}
</VirtualHost>
# Include configuration file not operated by slapos. This file won't be erased
# or changed when slapgrid is ran. It can be freely customized by node admin.
Include %(custom_apache_conf)s
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment