Versionsunterschiede von Test Server / Setting Up Virtual Hosts




← Vorherige Änderung
Nächste Änderung →




26 26
27 %% sudo mkdir myproject%% 27 %% sudo mkdir myproject%%
28 28
    29 %% cd /srv/www/myproject %%
    30
    31 %% mkdir htdocs%%
    32
29 Create a new file in the above mentioned directory by using the following command. 33 Create a new file in the above mentioned directory by using the following command.
30 34
31 %% echo -e '<html>\n<html>\n\t<body>\n\t\t<h1>Welcome World!</h1>\n\t</body>\n</html>' > /srv/www/htdocs/myproject/index.html %% 35 %% echo -e '<html>\n<html>\n\t<body>\n\t\t<h1>Welcome World!</h1>\n\t</body>\n</html>' > /srv/www/myproject/htdocs/index.html %%
32 36
33 Create a new virtualhost configuration file in the below mentioned directory and configure it as follows. 37 Create a new virtualhost configuration file in the below mentioned directory and configure it as follows.
34 38
35 /etc/apache2/conf.d/vhost.conf 39 /etc/apache2/conf.d/vhost.conf
36 40
37 %% sudo su%% 41 %% sudo su%%
38 %%echo -e 'DocumentRoot "/srv/www/htdocs/myproject"\nServerName "myproject"' > /etc/apache2/conf.d/vhost.conf %% 42 %%echo -e 'DocumentRoot "/srv/www/myproject"\nServerName "myproject"' > /etc/apache2/conf.d/vhost.conf %%
39 43
40 Did it work? 44 Did it work?
41 %% cat /etc/apache2/conf.d/vhost.conf%% 45 %% cat /etc/apache2/conf.d/vhost.conf%%
44 You should see 48 You should see
45 49
46 %% DocumentRoot "/srv/www/htdocs/myproject" 50 %% DocumentRoot "/srv/www/htdocs/myproject"
47  ServerName "myproject" 51  ServerName "myproject.example.com"
48  %% 52  %%
49 53
50 ===Edit configuration file=== 54 ===Edit configuration file===