A place where the Joyent community can gather, help each other out, and stay informed.
You are not logged in.
Pages: 1
Hi peeps
i have had my rails app running fine and using mongrel clusters
today i wanted to add a maintenance page so when the domains re point from business host to new on-domand it would show up but i am getting this error
client denied by server configuration: /system/maintenance.html
any one come across this or know what i done wrong
ServerName www.host.com
DocumentRoot /var/rails/host/current/public<Directory /var/rails/host/current/public>
Options FollowSymLinks AllowOverride All Order allow,deny Allow from all
</Directory>ProxyPass / balancer://mongrel_cluster/
ProxyPassReverse / balancer://mongrel_cluster/RewriteEngine On
#Check for maintenance file and redirect all requests
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]#Make sure people go to www.host.com, not host.com
#RewriteCond %{HTTP_HOST} ^host.com$ [NC]
#RewriteRule ^(.*)$ http://www.host.com$1 [R=301,L]
- Rewrite index to check for static
RewriteRule ^/$ /index.html [QSA]
- Rewrite to check for Rails cached page
RewriteRule ([.]+)$ $1.html [QSA]
- Redirect all non-static requests to cluster
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://mongrel_cluster%{REQUEST_URI} [P,QSA,L]- Deflate
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/javascript text/css
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4.0678 no-gzip
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
Thanks
Nick
Last edited by Loophole (2007-02-23 16:35:36)
Offline
I work with Nick, I'll try and expand on the problem.
We're using capistrano to deploy to our container, we're using Apache along mongrel etc. and that is working well. We want to take advantage of the enable/disable_web stuff, placing a maintenance.html in public/system/ etc.
When we place the maintenance.html file in the system directory, we get a 403 (You don't have permission to access / on this server) from the browser, removing it everything seems to work fine. It seems to be a problem with the rewrite rule in apache or a permissions problem. Can anyone suggest where to look first?
Cheers,
Garth
Offline
More info on this
Current setup
My rails apps runs from
/var/rails/fantasyfestivals/current/
Current has a symbolic to
/var/rails/fantasyfestivals/releases/20070222144425/
The rewrtie in my conf file is
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /system/maintenance.html [L]
/var/rails/fantasyfestivals/releases/20070222144425/public/system
System has a symbolic to
/var/rails/fantasyfestivals/shared/system/
Where the maintenance.html file lives
With this setup we get a 403 (You don't have permission to access / on this server) from the browser
Now I moved the maintenance.html to the public folder and changed the rewrite excluding the system
And this works fine now
Can any one explain why this would not work from /var/rails/fantasyfestivals/shared/system/ but would work from /var/rails/fantasyfestivals/releases/20070222144425/public/
Regards
Nick
Offline
This was a fun one. So it appears it has to do with /system existing on your webserver.
I had this problem on my Mac and my Joyent accelerator.
The following is on a system that contains /system/. For some reason it stats outside it's
doc root, and finds /system thus upsetting apache and throwing the 403.
9544/0xa4aff20: stat("/system", 0xBFFFEFE0, 0x1F40) = 0 0
9544/0xa4aff20: stat("/system/maintenance.html", 0xBFFFEFB0, 0x1F40) = -1 Err#2
9544/0xa4aff20: lstat("/system", 0xBFFFEFB0, 0x1F40) = 0 0
9544/0xa4aff20: lstat("/system/maintenance.html", 0xBFFFEFB0, 0x1F40) = -1 Err#2
9544/0xa4aff20: write(0x9, "[Thu Dec 06 10:57:42 2007] [error] [client 127.0.0.1] client denied by server configuration: /system/maintenance.htmln377377377377377377377377377377377377377377377377377377377377377377377377377377377377377377377377377377377377377377", 0x76) = 118 0
Changing the maintenance rewrite rule from system to my_system appears to work. Apache stats
for /my_system which is not found then stats back into doc_root.
9556/0xa4aff20: stat("/my_system", 0xBFFFEFE0, 0x1F40) = -1 Err#2
9556/0xa4aff20: stat("/Users/john/svn/topics/public/my_system/maintenance.html", 0xBFFFEDB0, 0x1F40) = 0 0
9556/0xa4aff20: stat("/my_system", 0xBFFFEFE0, 0x1F40) = -1 Err#2
9556/0xa4aff20: stat("/Users/john/svn/topics/public/my_system/maintenance.html", 0xBFFFEFB0, 0x1F40) = 0 0
9556/0xa4aff20: open("/Users/john/svn/topics/public/my_system/maintenance.html", 0x0, 0x0) = 16 0
Looks like this can be fixed by changing the rewrite rules to:
RewriteCond %{DOCUMENT_ROOT}/system/maintenance.html -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ %{DOCUMENT_ROOT}/system/maintenance.html [L]
Last edited by jdewey2 (2007-12-06 22:33:27)
Offline
Thanks for the writeup. I was struggling with this and made the same conclusions about what was going on but wasn't able to find a fix. I ended up making a copy of system with a different name to get around it but have now applied your fix which works perfectly!
Offline
Pages: 1