LAMP - comprehensive installation Apache, MySQL, PHP in OS Linux, in our case it will be
FreeBSD.
Installation order:
make install clean
rehash
In the component settings do not forget to mark items with "MySQL".
Setup web-server's autostart:
echo 'apache24_enable="YES"' >> /etc/rc.conf
And loading accf_http module for buffering HTTP connections:
echo 'accf_http_ready="YES"' >> /etc/rc.conf
Start web-server: "service apache24 start" and check the opening of the start page.
make install clean
cd /usr/ports/lang/php72-extensions
make install clean
cd /usr/ports/www/mod_php72
make install clean
rehash
When installing related packages, do not forget to specify MySQL(MySQLi) database support.
ee /usr/local/etc/apache24/httpd.conf
Configure parameters: ServerName (host DNS name), ServerAdmin (administrator's e-mail), DocumentRoot (location of the root directory of the site).
Uncomment "LoadModule rewrite_module libexec/apache24/mod_rewrite.so".
Change parameter "DirectoryIndex" to:"DirectoryIndex index.php index.html index.htm default.htm default.html".
Find strings:
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
and add after them:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Save and exit "httpd.conf".
Then copy "php.ini" from template:
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
chmod 444 /usr/local/etc/php.ini
Restart web-server: "service apache24 restart".
make install clean
rehash
Attention! If the system says that another version of the MySQL client is already installed, then you need to uninstall it, and then continue installing the latest version of the server.
Example:
cd /usr/ports/databases/mysql56-client
make deinstall clean
Setup autostart:"echo 'mysql_enable="YES"' >> /etc/rc.conf".
Start database server: "service mysql-server start".
Run "mysqladmin -u root password 'my_password'" and setup password for user "root". By default, the password is blank, so it must be changed. Next, check the connection with the command "mysql -u root -p". If after entering the password you are in the MySQL server control line, everything works correctly. Use the "quit" command to exit back to the shell.
make install clean
rehash
cd /usr/local/www/phpMyAdmin
cp config.sample.inc.php config.inc.php
ee config.inc.php
Fill in the field:
$cfg['blowfish_secret'] = 'YOUR_PASS'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
Set secret about 32 characters.
Save the file and proceed to configure Apache: "ee /usr/local/etc/apache24/httpd.conf":
In the " <IfModule alias_module>" section add the following line:
Alias /phpmyadmin /usr/local/www/phpMyAdmin
2. After "Directory" section add:
<Directory "/usr/local/www/phpMyAdmin">
AllowOverride None
Options None
Require all granted
</Directory>
Restart web-server: "service apache24 restart" and check phpMyAdmin. You can also add parameters to allow access from specific subnets or hosts. For example:
Order Allow,Deny
Allow from 192.168.1.0/24
mkdir /usr/local/www/vhosts
mkdir /usr/local/www/vhosts/site1.local
mkdir /usr/local/www/vhosts/site2.local
Uncomment the line in https.conf:
Include etc/apache24/extra/httpd-vhosts.conf
And add a directive:
<Directory "/usr/local/www/vhosts">
AllowOverride None
Options None
Require all granted
</Directory>
Save changes and edit virtual host configuration file:
ee /usr/local/etc/apache24/extra/httpd-vhosts.conf
Delete all the contents and introduce our two hosts there as an example:
<VirtualHost *:80>
ServerAdmin admin@mail.com
DocumentRoot "/usr/local/www/vhosts/site1.local"
ServerName site1.local
ServerAlias www.site1.local
<Directory /usr/local/www/vhosts/site1.local>
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin@mail.com
DocumentRoot "/usr/local/www/vhosts/site2.local"
ServerName site2.local
ServerAlias www.site2.local
<Directory /usr/local/www/vhosts/site2.local>
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Restart Apache. Now the sites will be divided and accessible each in its own name. The necessary entries for name resolution must be configured in DNS.
FreeBSD.
Installation order:
Apache:
cd /usr/ports/www/apache24make install clean
rehash
In the component settings do not forget to mark items with "MySQL".
Setup web-server's autostart:
echo 'apache24_enable="YES"' >> /etc/rc.conf
And loading accf_http module for buffering HTTP connections:
echo 'accf_http_ready="YES"' >> /etc/rc.conf
Start web-server: "service apache24 start" and check the opening of the start page.
PHP:
cd /usr/ports/lang/php72make install clean
cd /usr/ports/lang/php72-extensions
make install clean
cd /usr/ports/www/mod_php72
make install clean
rehash
When installing related packages, do not forget to specify MySQL(MySQLi) database support.
Apache & PHP setup:
Configure httpd.conf:ee /usr/local/etc/apache24/httpd.conf
Configure parameters: ServerName (host DNS name), ServerAdmin (administrator's e-mail), DocumentRoot (location of the root directory of the site).
Uncomment "LoadModule rewrite_module libexec/apache24/mod_rewrite.so".
Change parameter "DirectoryIndex" to:"DirectoryIndex index.php index.html index.htm default.htm default.html".
Find strings:
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
and add after them:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Save and exit "httpd.conf".
Then copy "php.ini" from template:
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
chmod 444 /usr/local/etc/php.ini
Restart web-server: "service apache24 restart".
MySQL:
cd /usr/ports/databases/mysql80-servermake install clean
rehash
Attention! If the system says that another version of the MySQL client is already installed, then you need to uninstall it, and then continue installing the latest version of the server.
Example:
cd /usr/ports/databases/mysql56-client
make deinstall clean
Setup autostart:"echo 'mysql_enable="YES"' >> /etc/rc.conf".
MySQL setup:
Edit the configuration file if necessary: "ee /usr/local/etc/mysql/my.cnf".Start database server: "service mysql-server start".
Run "mysqladmin -u root password 'my_password'" and setup password for user "root". By default, the password is blank, so it must be changed. Next, check the connection with the command "mysql -u root -p". If after entering the password you are in the MySQL server control line, everything works correctly. Use the "quit" command to exit back to the shell.
phpMyAdmin:
cd /usr/ports/databases/phpmyadminmake install clean
rehash
phpMyAdmin setup:
Setup configuration file "config.inc.php":cd /usr/local/www/phpMyAdmin
cp config.sample.inc.php config.inc.php
ee config.inc.php
Fill in the field:
$cfg['blowfish_secret'] = 'YOUR_PASS'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
Set secret about 32 characters.
Save the file and proceed to configure Apache: "ee /usr/local/etc/apache24/httpd.conf":
In the "
Alias /phpmyadmin /usr/local/www/phpMyAdmin
2. After "Directory" section add:
<Directory "/usr/local/www/phpMyAdmin">
AllowOverride None
Options None
Require all granted
</Directory>
Restart web-server: "service apache24 restart" and check phpMyAdmin. You can also add parameters to allow access from specific subnets or hosts. For example:
Order Allow,Deny
Allow from 192.168.1.0/24
Additional configuration of virtual hosts (if necessary):
Let's create a directory for virtual hosts and a couple of sites for example:mkdir /usr/local/www/vhosts
mkdir /usr/local/www/vhosts/site1.local
mkdir /usr/local/www/vhosts/site2.local
Uncomment the line in https.conf:
Include etc/apache24/extra/httpd-vhosts.conf
And add a directive:
<Directory "/usr/local/www/vhosts">
AllowOverride None
Options None
Require all granted
</Directory>
Save changes and edit virtual host configuration file:
ee /usr/local/etc/apache24/extra/httpd-vhosts.conf
Delete all the contents and introduce our two hosts there as an example:
<VirtualHost *:80>
ServerAdmin admin@mail.com
DocumentRoot "/usr/local/www/vhosts/site1.local"
ServerName site1.local
ServerAlias www.site1.local
<Directory /usr/local/www/vhosts/site1.local>
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin@mail.com
DocumentRoot "/usr/local/www/vhosts/site2.local"
ServerName site2.local
ServerAlias www.site2.local
<Directory /usr/local/www/vhosts/site2.local>
Order Allow,Deny
Allow from all
</Directory>
</VirtualHost>
Restart Apache. Now the sites will be divided and accessible each in its own name. The necessary entries for name resolution must be configured in DNS.
No comments:
Post a Comment