-
Notifications
You must be signed in to change notification settings - Fork 0
/
apache_virtual_hosts.html
380 lines (337 loc) · 14.9 KB
/
apache_virtual_hosts.html
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
<!DOCTYPE html>
<html lang="en"
>
<head>
<title>APACHE: virtual hosts - Notes</title>
<!-- Using the latest rendering mode for IE -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="http://znotdead.github.io/static/img/ico/logo.png" rel="icon">
<link rel="apple-touch-icon" href="http://znotdead.github.io/static/img/ico/logo.png">
<link rel="canonical" href="http://znotdead.github.io/apache_virtual_hosts.html">
<meta name="author" content="znotdead" />
<meta name="keywords" content="Apache" />
<meta name="description" content="virtual hosts" />
<!-- Bootstrap -->
<link rel="stylesheet" href="http://znotdead.github.io/theme/css/bootstrap.min.css" type="text/css"/>
<link href="http://znotdead.github.io/theme/css/font-awesome.min.css" rel="stylesheet">
<link href="http://znotdead.github.io/theme/css/pygments/monokai.css" rel="stylesheet">
<link rel="stylesheet" href="http://znotdead.github.io/theme/css/style.css" type="text/css"/>
<link href="http://znotdead.github.io/static/css/main.css" rel="stylesheet">
<script src="http://znotdead.github.io/theme/js/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="http://znotdead.github.io/theme/js/bootstrap.min.js"></script>
<!-- Enable responsive features in IE8 with Respond.js (https://github.com/scottjehl/Respond) -->
<script src="http://znotdead.github.io/theme/js/respond.min.js"></script>
<script src="http://znotdead.github.io/static/js/jquery-latest.js"></script>
<script src="http://znotdead.github.io/static/js/jquery.tablesorter.min.js"></script>
<script src="http://znotdead.github.io/static/js/main.js"></script>
<link href="http://znotdead.github.io/feeds/all.atom.xml" type="application/atom+xml" rel="alternate"
title="Notes ATOM Feed"/>
</head>
<body>
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="http://znotdead.github.io/" class="navbar-brand">
<img src="http://znotdead.github.io/static/img/ico/logo.png" width="50"/> Notes </a>
</div>
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li >
<a href="http://znotdead.github.io/category/car.html">
<img src='/static/img/ico/car.png' width='50'>
</a>
</li>
<li >
<a href="http://znotdead.github.io/category/health.html">
<img src='/static/img/ico/health.png' width='50'>
</a>
</li>
<li >
<a href="http://znotdead.github.io/category/knitting.html">
<img src='/static/img/ico/knitting.png' width='50'>
</a>
</li>
<li >
<a href="http://znotdead.github.io/category/misc.html">
<img src='/static/img/ico/misc.png' width='50'>
</a>
</li>
<li >
<a href="http://znotdead.github.io/category/modeling.html">
<img src='/static/img/ico/modeling.png' width='50'>
</a>
</li>
<li class="active">
<a href="http://znotdead.github.io/category/programming.html">
<img src='/static/img/ico/programming.png' width='50'>
</a>
</li>
<li >
<a href="http://znotdead.github.io/category/recipes.html">
<img src='/static/img/ico/recipes.png' width='50'>
</a>
</li>
<li >
<a href="http://znotdead.github.io/category/songs.html">
<img src='/static/img/ico/songs.png' width='50'>
</a>
</li>
<li >
<a href="http://znotdead.github.io/category/vim.html">
<img src='/static/img/ico/vim.png' width='50'>
</a>
</li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="http://znotdead.github.io/archives.html"><i class="fa fa-th-list"></i><span class="icon-label">Archives</span></a></li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
</div> <!-- /.navbar -->
<div class="container">
<div class="row">
<div class="col-sm-9">
<section id="content">
<article>
<header class="page-header">
<h1>
<a href="http://znotdead.github.io/apache_virtual_hosts.html"
rel="bookmark"
title="Permalink to APACHE: virtual hosts">
APACHE: virtual hosts
</a>
</h1>
</header>
<div class="entry-content">
<div class="panel">
<div class="panel-body">
<footer class="post-info">
<span class="label label-default">Date</span>
<span class="published">
<i class="fa fa-calendar"></i><time datetime="2011-12-09T13:34:00+01:00"> Fri 09 December 2011</time>
</span>
<span class="label label-default">Tags</span>
<a href="http://znotdead.github.io/tag/apache.html">Apache</a>
</footer><!-- /.post-info --> </div>
</div>
<h3>APACHE: virtual hosts</h3>
<p>Very useful <a href="http://wiki.apache.org/httpd/CommonMisconfigurations">page</a>.</p>
<p>On Debian there is <code>ports.conf</code> file for apache where <code>Listen port</code> and <code>NameVirtualHost</code> specified. So there is no need to specify it in <code>httpd.conf</code>.</p>
<p>It causes warnings when</p>
<div class="highlight"><pre><span class="err">$</span> <span class="o">/</span><span class="n">usr</span><span class="o">/</span><span class="n">sbin</span><span class="o">/</span><span class="n">apache2ctl</span> <span class="n">configtest</span>
<span class="s">"NameVirtualHost *:80 has no VirtualHosts"</span>
</pre></div>
<p>as it was in my case. Also I disabled all <code>./site-enabled</code> sites and then my sites from httpd start working.</p>
<p>here my <code>httpd.conf</code>:</p>
<div class="highlight"><pre><span class="nt"><Directory</span> <span class="err">/var/www</span><span class="nt">></span>
Order deny,allow
Allow from all
<span class="nt"></Directory></span>
<span class="nt"><VirtualHost</span> <span class="err">*:80</span><span class="nt">></span>
DocumentRoot /var/www/site1
ServerName www.site1.my
ServerAlias site1.my
# Other directives here
WSGIScriptAlias / /var/www/site1/apache/site1.wsgi
Alias /media /var/www/site1/media/
<span class="nt"></VirtualHost></span>
<span class="nt"><VirtualHost</span> <span class="err">*:80</span><span class="nt">></span>
DocumentRoot /var/www/site2
ServerName www.site2.my
ServerAlias site2.my
# Other directives here
WSGIScriptAlias / /var/www/site2/apache/site2.wsgi
Alias /media /var/www/site2/media/
<span class="nt"></VirtualHost></span>
</pre></div>
</div>
<!-- /.entry-content -->
<hr/>
<section class="comments" id="comments">
<h2>Comments</h2>
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'znotdeadnotes'; // required: replace example with your forum shortname
var disqus_identifier = 'apache_virtual_hosts';
var disqus_url = 'http://znotdead.github.io/apache_virtual_hosts.html';
var disqus_config = function () {
this.language = "en";
};
/* * * DON'T EDIT BELOW THIS LINE * * */
(function () {
var dsq = document.createElement('script');
dsq.type = 'text/javascript';
dsq.async = true;
dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by
Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
</section>
</article>
</section>
</div>
<div class="col-sm-3" id="sidebar">
<aside>
<section class="well well-sm">
<ul class="list-group list-group-flush">
<li class="list-group-item"><a href="http://znotdead.github.io/"><h4><i class="fa fa-tags fa-lg"></i><span class="icon-label">Tags</span></h4></a>
<ul class="list-group list-inline tagcloud" id="tags">
<li class="list-group-item tag-3">
<a href="http://znotdead.github.io/tag/apache.html">
Apache
</a>
</li>
<li class="list-group-item tag-4">
<a href="http://znotdead.github.io/tag/development.html">
development
</a>
</li>
<li class="list-group-item tag-1">
<a href="http://znotdead.github.io/tag/django.html">
Django
</a>
</li>
<li class="list-group-item tag-4">
<a href="http://znotdead.github.io/tag/docker.html">
Docker
</a>
</li>
<li class="list-group-item tag-4">
<a href="http://znotdead.github.io/tag/git.html">
Git
</a>
</li>
<li class="list-group-item tag-4">
<a href="http://znotdead.github.io/tag/heroku.html">
Heroku
</a>
</li>
<li class="list-group-item tag-3">
<a href="http://znotdead.github.io/tag/html.html">
HTML
</a>
</li>
<li class="list-group-item tag-2">
<a href="http://znotdead.github.io/tag/js.html">
JS
</a>
</li>
<li class="list-group-item tag-1">
<a href="http://znotdead.github.io/tag/linux.html">
Linux
</a>
</li>
<li class="list-group-item tag-4">
<a href="http://znotdead.github.io/tag/mercurial.html">
Mercurial
</a>
</li>
<li class="list-group-item tag-1">
<a href="http://znotdead.github.io/tag/mysql.html">
MySQL
</a>
</li>
<li class="list-group-item tag-4">
<a href="http://znotdead.github.io/tag/nosql.html">
NoSQL
</a>
</li>
<li class="list-group-item tag-4">
<a href="http://znotdead.github.io/tag/pip.html">
pip
</a>
</li>
<li class="list-group-item tag-2">
<a href="http://znotdead.github.io/tag/python.html">
Python
</a>
</li>
<li class="list-group-item tag-4">
<a href="http://znotdead.github.io/tag/rabbitmq.html">
RabbitMQ
</a>
</li>
<li class="list-group-item tag-4">
<a href="http://znotdead.github.io/tag/redis.html">
Redis
</a>
</li>
<li class="list-group-item tag-4">
<a href="http://znotdead.github.io/tag/svn.html">
SVN
</a>
</li>
<li class="list-group-item tag-4">
<a href="http://znotdead.github.io/tag/travis.html">
Travis
</a>
</li>
<li class="list-group-item tag-4">
<a href="http://znotdead.github.io/tag/ubuntu.html">
Ubuntu
</a>
</li>
</ul>
</li>
</ul>
</section>
</aside>
</div>
</div>
</div>
<footer>
<div class="container">
<hr>
<div class="row">
<div class="col-xs-10">© 2017 znotdead
· Powered by <a href="https://github.com/DandyDev/pelican-bootstrap3" target="_blank">pelican-bootstrap3</a>,
<a href="http://docs.getpelican.com/" target="_blank">Pelican</a>,
<a href="http://getbootstrap.com" target="_blank">Bootstrap</a> </div>
<div class="col-xs-2"><p class="pull-right"><i class="fa fa-arrow-up"></i> <a href="#">Back to top</a></p></div>
</div>
</div>
</footer> <!-- Disqus -->
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = 'znotdeadnotes'; // required: replace example with your forum shortname
/* * * DON'T EDIT BELOW THIS LINE * * */
(function () {
var s = document.createElement('script');
s.async = true;
s.type = 'text/javascript';
s.src = '//' + disqus_shortname + '.disqus.com/count.js';
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
}());
</script>
<!-- End Disqus Code -->
<!-- Google Analytics -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-57013075-1']);
_gaq.push(['_trackPageview']);
(function () {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- End Google Analytics Code -->
</body>
</html>