Versionsunterschiede von Test Server / Setting Up Virtual Hosts
|
â Vorherige Ănderung
|
|
| 6 | |
|---|---|
| 7 | To setup a custom virtual host, we need to follow these steps: |
| 8 | |
| 9 | ===Allow virtual hosts=== |
| 10 | By default, Apache2 won't use the ##/etc/apache2/vhosts.d/*.conf## files (the location of the virtual hosts), therefore we need to indicate that this file will be included during the runtime of Apache. |
| 11 | |
| 12 | Once you have installed and checked the status of Apache, go to its Web-root directory and create a new directory as mentioned below. |
| 13 | %% cd /srv/www/ |
| 14 | |
| 15 | %% sudo mkdir wiki %% |
| 16 | |
| 17 | Create a new file in the above mentioned directory by using the following command. |
| 18 | |
| 19 | %% echo -e '<html>\n<html>\n\t<body>\n\t\t<h1>MyWiki Works!</h1>\n\t</body>\n</html>' > /srv/www/htdocs/wiki/index.html %% |
| 20 | |
| 21 | Create a new virtualhost configuration file in the below mentioned directory and configure it as follows. |
| 22 | |
| 23 | /etc/apache2/conf.d/vhost.conf |
| 24 | |
| 25 | %% echo -e 'DocumentRoot\"/srv/www/htdocs/site1\"\nServerName www.linuxhelp1.com"\' > /etc/apache2/conf.d/vhost.conf %% |
| 26 | |
| 27 | ---- |
| 28 | |
| 29 | |
| 30 | |
| 31 | **/opt/lampp/etc/httpd.conf** |
| … | … |
| 35 | %%# Virtual hosts |
| 36 | Include etc/extra/httpd-vhosts.conf %% |
| 37 | |
| 38 | ===Weblinks=== |
| 39 | https://doc.opensuse.org/documentation/leap/reference/html/book-reference/cha-apache2.html |
| 40 | |
| 41 | ((https://doc.opensuse.org/documentation/leap/reference/html/book-reference/cha-apache2.html#sec-apache2-configuration-manually-configfiles-etc-apache2)) |
| 42 | ===Create a custom domain in the hosts file of your system=== |
| 43 | |
| 44 | You need to create a custom domain where our apache virtual host will point to. This domain will be normally an ip (127.0.0.xx based) and a custom name. |
| … | … |
| 76 | Start apache and mysql (entire XAMPP). |
| 77 | Navigate in your browser to ##~http://myproject/## or ##~http://127.0.0.3/##. |
| 78 |