File: apache.conf

package info (click to toggle)
samizdat 0.6.1-3lenny1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,208 kB
  • ctags: 962
  • sloc: ruby: 6,685; xml: 636; sql: 478; sh: 131; makefile: 62
file content (149 lines) | stat: -rw-r--r-- 4,606 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
#
# Apache configuration for Samizdat engine - Name-based virtual host
#

# Do not log IP addresses in your access.log
LogFormat "- %l %u %t \"%r\" %>s %b" noip

<VirtualHost *>
    # Replace "samizdat" with FQDN of your site
    ServerName samizdat
    ServerAdmin "webmaster at localhost"

    # Change to a directory where you want to see your log files
    CustomLog /var/log/apache2/samizdat/access.log noip
    # See http://dev.riseup.net/privacy/apache/ for alternatives
    ErrorLog /dev/null

    # Replace "/var/www/samizdat" here and onward with your document
    # root (used to hold site-specific static public files, e.g.
    # favicon)
    DocumentRoot /var/www/samizdat
    <Directory /var/www/samizdat>
        Options FollowSymLinks
        AllowOverride None
        DirectoryIndex dispatch.rb
        RewriteEngine on

        # Don't rewrite requests to static content
        RewriteCond %{REQUEST_URI} ^/(content|css)
        RewriteRule .* - [L]

        # Send everything else to dispatch.rb
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ dispatch.rb [QSA,L]
    </Directory>

    # Change "/var/www/samizdat/content/" to wherever you want your
    # uploaded files to be stored. Make sure the directory is writable
    # by web server user (www-data)
    Alias /content/ /var/www/samizdat/content/
    <Directory /var/www/samizdat/content> 
        Options Indexes
        RewriteEngine off
        DirectoryIndex index.html
        <Files *.rb>
            Order deny,allow
            Deny from all
        </Files>
        <LimitExcept GET>
            Order deny,allow
            Deny from all
        </LimitExcept>
    </Directory>

    Alias /css/ /usr/share/samizdat/css/

    AliasMatch ^/(dispatch)\.rb /usr/share/samizdat/cgi-bin/$1.rb
    <Directory /usr/share/samizdat/cgi-bin>
        Options ExecCGI
        # CGI modules are placed in reverse order of preference, so that
        # the last to succeed overrides previous directives
        <IfModule mod_cgi.c>
            SetHandler cgi-script
        </IfModule>
        <IfModule mod_fastcgi.c>
            SetHandler fastcgi-script
        </IfModule>
        <IfModule mod_fcgid.c>
            SetHandler fcgid-script
        </IfModule>
        <IfModule mod_ruby.c>
            SetHandler ruby-object
            RubyHandler Apache::RubyRun.instance
            RubyRequire apache/ruby-run
        </IfModule>
        <LimitExcept GET POST>
            Order deny,allow
            Deny from all
        </LimitExcept>
    </Directory>
</VirtualHost>

#
# Apache configuration for Samizdat engine - Directory-based site
#

# Replace the first "/samizdat" below with your site location for all
# aliases, change "/var/www/samizdat/content/" to wherever you want your
# uploaded files to be stored. Make sure the directory is writable by
# web server user (www-data).  
Alias /samizdat/content/ /var/www/samizdat/content/
<Directory /var/www/samizdat/content> 
    Options Indexes
    RewriteEngine off
    DirectoryIndex index.html
    <Files *.rb>
        Order deny,allow
        Deny from all
    </Files>
    <LimitExcept GET>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>

# Replace the first "/samizdat" here with your site location for all aliases
Alias /samizdat/css/ /usr/share/samizdat/css/

AliasMatch ^/samizdat/(dispatch)\.rb /usr/share/samizdat/cgi-bin/$1.rb
<Directory /usr/share/samizdat/cgi-bin>
    Options ExecCGI
    # CGI modules are placed in reverse order of preference, so that
    # the last to succeed overrides previous directives
    <IfModule mod_cgi.c>
        SetHandler cgi-script
    </IfModule>
    <IfModule mod_fastcgi.c>
        SetHandler fastcgi-script
    </IfModule>
    <IfModule mod_fcgid.c>
        SetHandler fcgid-script
    </IfModule>
    <IfModule mod_ruby.c>
        SetHandler ruby-object
        RubyHandler Apache::RubyRun.instance
        RubyRequire apache/ruby-run
    </IfModule>
    <LimitExcept GET POST>
        Order deny,allow
        Deny from all
    </LimitExcept>
</Directory>

# Site root location and directory, used to store static public files
Alias /samizdat/ /var/www/samizdat/
<Directory /var/www/samizdat>
    Options FollowSymLinks
    AllowOverride None
    DirectoryIndex dispatch.rb
    RewriteEngine on

    # Don't rewrite requests to static content
    RewriteCond %{REQUEST_URI} ^/samizdat/(content|css)
    RewriteRule .* - [L]

    # Send everything else to dispatch.rb
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ dispatch.rb [QSA,L]
</Directory>