Create the Directory Structure:
# mkdir /usr/local/www/apache24/microtechna_com
# mkdir /usr/local/www/apache24/nextcloud15
Ownership to webserver user(www user in www group in freebsd):
# chown -R www:www /usr/local/www/apache24/nextcloud15
# chown -R www:www /usr/local/www/apache24/microtechna_com/
Grant write permissions for group/other:
# chmod -R go+w /usr/local/www/apache24/nextcloud15/
# chmod -R go+w /usr/local/www/apache24/microtechna_com/
See the Permissions:
# ls -la /usr/local/www/apache24/nextcloud15/
# ls -la /usr/local/www/apache24/microtechna_com/
Create Demo Pages for Each Virtual Host:
# ee /usr/local/www/apache24/microtechna_com/info.php
# ee /usr/local/www/apache24/nextcloud15/info.php
<?php infophp(); ?>
Backup httpd.conf:
# cp /usr/local/etc/apache24/httpd.conf /usr/local/etc/apache24/httpd.conf.orginal
Backup httpd-vhosts.conf
# cp /usr/local/etc/apache24/extra/httpd-vhosts.conf /usr/local/etc/apache24/extra/httpd-vhosts.conf.orginal
# cp /usr/local/etc/apache24/extra/httpd-vhosts.conf.orginal /usr/local/etc/apache24/extra/httpd-vhosts.conf
To set up multiple ports, you need to edit the httpd.conf file:
# ee usr/local/etc/apache24/httpd.conf
Add/edit the following lines:
Listen 192.168.1.42:80
Listen 192.168.1.43:8080
Understanding the directive:
ServerRoot "/usr/local"
Specifies the default directory hierarchy for the Apache installation. Binaries are stored in the bin and sbin subdirectories of the server root and configuration files are stored in the etc/apache2x subdirectory.
ServerAdmin you@example.com
Change this to the email address to receive problems with the server. This address also appears on some server-generated pages, such as error documents.
ServerName www.example.com:80
Allows an administrator to set a hostname which is sent back to clients for the server. For example, www can be used instead of the actual hostname. If the system does not have a registered DNS name, enter its IP address instead. If the server will listen on an alternate report, change 80 to the alternate port number.
DocumentRoot "/usr/local/www/apache2x/data"
Create the First Virtual Host:
# vi /usr/local/etc/apache24/extra/httpd-vhosts.conf
or, # service apache24 configtest
This command will dump out a description of how Apache parsed the configuration file.
# apachectl -S
Restart Apache:
# service apache24 restart
FreeBSD firewall IPFW port check:
IPFW stateful firewall written for FreeBSD
Essential Directory list:
# ls /usr/local/etc/apache24/httpd.conf
# ls /usr/local/www/apache24/microtechna_com/ index.html
# vi /usr/local/etc/apache24/extra/httpd-vhosts.conf
Ref links:
Apache HTTP Server
Apache Virtual Host documentation
httpd - Apache Hypertext Transfer Protocol Server
IPFW stateful firewall written for FreeBSD
<VirtualHost *:80>
ServerName 192.168.10.114:8080
ServerAlias example
DocumentRoot "/usr/local/www/apache24/nextcloud15"
DirectoryIndex index.php index.html
<Directory /usr/local/www/apache24/nextcloud15>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://localhost/"
</FilesMatch>
ErrorLog /var/log/nextcloud15-error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/nextcloud15-access.log combined
</VirtualHost>
# ee /etc/rc.conf
Essential Directory list:
# ls /usr/local/etc/apache24/httpd.conf
# ls /usr/local/www/apache24/microtechna_com/ index.html
# vi /usr/local/etc/apache24/extra/httpd-vhosts.conf
Ref links:
Apache HTTP Server
Apache Virtual Host documentation
httpd - Apache Hypertext Transfer Protocol Server
IPFW stateful firewall written for FreeBSD
<VirtualHost *:80>
ServerName 192.168.10.114:8080
ServerAlias example
DocumentRoot "/usr/local/www/apache24/nextcloud15"
DirectoryIndex index.php index.html
<Directory /usr/local/www/apache24/nextcloud15>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/var/run/php5-fpm.sock|fcgi://localhost/"
</FilesMatch>
ErrorLog /var/log/nextcloud15-error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
CustomLog /var/log/nextcloud15-access.log combined
</VirtualHost>
No comments:
Post a Comment