📜 ⬆️ ⬇️

Installing FAMP on pfsense

In the standard pfsense packages, there is neither MySQL nor full-featured Apache. PHP is present in the system by default, being the main scripting language, but the necessary modules mysql.so are missing and there are its own pfsense.so, ssh2.so, etc.

Unlike FreeBSD, many startup scripts and configuration files (rc.conf, rc.local) have been removed, their own mechanisms written in PHP are used instead.

Pfsense is a kind of wrapper like barley webmin. Fortunately, there is a pkg pager system, with which I will install the necessary software and describe several tricks that will help host sites on a system originally intended to be an Internet gateway.

I put everything on a bare system - in any case, do not forget to backup.
')
After installation and initial configuration, you must release port 80 from lighthttp.
System - Advanced - webConfigurator - TCP port = 88

All other work will be in the console, which includes:
System - Advanced - Secure Shell - Enable Secure Shell

pkg install apache24 mysql56-server mod_php55 php55-mysql php55-mysqli 

It is desirable to install PHP version 55. because it is the system, otherwise there may be problems with the modules.

There is no rc.conf in the system, so services do not start.
Trick one: add entries to /etc/defaults/rc.conf :

 apache24_enable="YES" mysql_enable="YES" 

The system cleans the / tmp directory on every boot.

Trick two: put the muscle socket in /var/tmp/mysql.sock .

Edit (create) the file /usr/local/etc/my.cnf :

 [client] port = 3306 socket = /var/tmp/mysql.sock [mysqld] port = 3306 socket = /var/tmp/mysql.sock skip-external-locking key_buffer_size = 16M max_allowed_packet = 1M table_open_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M init-connect='SET NAMES utf8' collation_server = utf8_unicode_ci character_set_server = utf8 character_set_client = utf8 character_set_filesystem = utf8 log-bin=mysql-bin binlog_format=mixed server-id = 1 [mysqldump] quick max_allowed_packet = 16M [mysql] no-auto-rehash [client] default-character-set = utf8 [myisamchk] key_buffer_size = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout 

Php.ini is generated each time by the script at system startup.

Trick three: edit /etc/rc.php_ini_setup :

Before ; Extensions :

 [mbstring] mbstring.internal_encoding = UTF-8 mbstring.func_overload = 2 

After ; Extensions insert:

 extension=mysql.so extension=mysqli.so 

To prevent villi from popping out, we change on to Off:

 display_startup_errors=Off display_errors=Off 

The /usr/local/etc/rc.d directory is not a start. In order to start the services automatically, we create two files /etc/rc.local and /etc/rc.local.running .

Trick four: edit /etc/rc.local :

 /usr/sbin/service mysql-server start /usr/sbin/service apache24 start 

Reboot and configure Apache virtual hosts to taste, I put Bitrix on one of them for the subsequent organization of warehouse accounting.

When installing bitrix as a muscle server, we specify not localhost, but 127.0.0.1.

Source: https://habr.com/ru/post/254847/


All Articles