Of course, you need to install the download acceleration first, otherwise the following installation will be very slow.
To install, use the following instructions:
#cd /usr/ports/ftp/prozilla
#make install clean
In the middle will appear:
This is an example and a manual page in HTML format. If you don’t want to use it and want to study it later, you can add it, and then click OK.
After installation is complete, edit or create /etc/make.conf:
#ee /etc/make.conf
Comment out the original part with #. If it is a minimal installation, this file will not be available for the time being. Add the following:
FETCH_CMD= proz
FETCH_BEFORE_ARGS= -r -k=4 –s FETCH_AFTER_ARGS= DISABLE_SIZE= yes If prozilla occasionally fails to download normally, you can # remove the content we added in /etc/make.conf. 2. Use the following instructions to install Apache2.2.X : # cd /usr/ports/www/apache22 #make install clean The following figure appears:
Choose the installation modules according to your own needs. If you don’t know which ones to choose, just default and just answer OK.
The default is enough, so I answer OK here,
The installation is completed after a few minutes. The speed depends on the speed of your network, because it downloads the installation package online.
[Cut-Page]3. Install PHP5.2.1
Execute the following instructions:
# cd /usr/ports/lang/php5
make install clean
In the pop-up prompt box, use the following configuration
4. After completion, continue to install some commonly used PHP modules.
Please execute the following instructions:
# cd /usr/ports/lang/php5-extensions/
make install clean
In the pop-up prompt box, use the following configuration
A menu appears. In addition to the default items, we must select the following commonly used items: CTYPE, CURL, EXIF, FOLTER, FTP, GD, GETEXT, GMP, MBSTRING, MCRYPT, MYQL, PDF, IMAP, PCRE, SESSION, SOCKETS, ZLIB, ZIP. These projects are very commonly used, especially SESSION.
Then a menu will appear, just keep the default:
Then select this:
After all, this is what foreigners "want" Chinese people to use.
After the installation is complete, run cp –rp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini #php5
[Cut-Page]5.Install MySQL
Use the following command
# cd /usr/ports/databases/mysql50-server
# make install clean
# cd /usr/ports/databases/php5-mysql
# make install clean
6. Apache2.2.X basic settings
After installing Apache, we must first make some basic settings before we can start using it. In this section, we first introduce the more commonly used setting items so that you can quickly configure the web server. More detailed Apache settings will be explained in the next section. Apache's configuration file is located at:
/usr/local/etc/apache22/httpd.conf, /usr/local/etc/apache22/extra/httpd-languages.conf, /usr/local/etc/apache22/extra/httpd-default.conf.
Set /usr/local/etc/apache22/httpd.conf
ServerAdmin sets administrator email
Set your email address. This email address will appear on the page when an error message appears on the page. The following examples are default values:
ServerAdmin [email protected]
ServerName sets the host name and port number
ServerName allows you to set your host name. If you do not have a host name, you can set it to the IP used by your machine. ServerName will be used to redirect the URL. For example, when you enter a URL "http://www.example.com/dir", Apache will refer to your settings in ServerName and change www.example.com to ServerName, and add a slash "/" after the URL you entered to connect to the dir directory, that is, redirect the URL to "http://www.example.com/dir/". If your URL settings are incorrect, users may be directed to an address that doesn't exist.
So, if you don't have a hostname, you can set this value to an IP so that the URL can still be redirected to the correct place. In the setting of ServerName, we also specified the HTTP connection port 80.
ServerName www.example.com:80
DocumentRoot sets the root directory of the web page
DocumentRoot allows us to specify the location of the root directory of the web page, which is the directory where we store the web page.
DocumentRoot "/usr/local/www/apache22/data"
After setting the DocumentRoot, we must then set the permissions of the directory. After DocumentRoot, there are the following sections: (there are some # comments in the middle)
Options Indexes FollowSymLinks annotate this
#Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
You must add
DirectoryIndex specifies the default web page file name
DirectoryIndex index.html index.htm index.php index.php3 index.cgi index.pl
When a user uses the URL " http://www.example.com/dir " to connect to a directory, if there is no specified web page, Apache will check to see if the web page set in DirectoryIndex exists. If it exists, the default page will be displayed. set up web pages.
Add PHP support
If you want to use PHP, you must add PHP support to httpd.conf. Please add the following content around other AddTypes in the httpd.conf file for classification:
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Cancel the # before #AddHandler cgi-script .cgi and add .pl to support cgi, pl such as: AddHandler cgi-script .cgi .pl
After the above settings are completed, you can save and exit. Next, we must modify /etc/rc.conf and add the following settings to start Apache at boot:
apache22_enable="YES"
After restarting the virtual machine, open the web page http://IP/ (please change the IP to your virtual machine IP), and it will display It works!. Unlike the original, there is a beautiful page.
We can add a new file in the root directory of the web page to test whether PHP is functioning normally. Please use document editing software to open a new file test.php under /usr/local/www/apache22/data and add the following content:
<?
phpinfo();
?>
Next, you can connect to the webpage http://IP/test.php (please change the IP to your virtual machine IP) to see if you can use PHP. If PHP is supported, the PHP configuration will be displayed. If not, only the above file content will appear.
[Cut-Page]7. MySQL5.0.33 basic settings
Modify /etc/rc.conf and add the following line to start MySQL at boot:
mysql_enable="yes"
You can then start MySQL using the following command:
# /usr/local/etc/rc.d/mysql-server start
After starting MySQL, we can use the following command to enter the MySQL interactive command line:
# /usr/local/bin/mysql mysql
If the installation is successful, you will see the following screen:
When MySQL was first installed, the root password was not set, so we need to set the root password and update the settings in real time:
mysql> UPDATE user SET password=password('your password') where user='root';
Query OK, 2 rows affected (0.01 sec)
Rows matched: 2 Changed: 2 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
Finally, please use exit; to leave MySQL.
8. Install ZendOptimizer 3.2.8
cd /usr/ports/devel/ZendOptimizer
make install clean
Just keep answering OK according to the prompts.
9. FTP basic settings (to upload other test web pages)
Here, we use the built-in vsftp.
Start the FTP server using inetd. First, please edit /etc/inetd.conf and remove the # at the beginning of the ftp settings:
ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l
ftp stream tcp6 nowait root /usr/libexec/ftpd ftpd -l
Then add it to /etc/rc.conf
inetd_enable="YES"
Next, we restart the virtual machine and start using FreeBSD's FTP service.
10. Lessons learned
If you install according to this tutorial, do not change the installation order, otherwise something will happen due to dependencies: at least you will have to write a few sentences, and at most you will have to reinstall something.
[Cut-Page]3. Install PHP5.2.1
Execute the following instructions:
# cd /usr/ports/lang/php5
make install clean
In the pop-up prompt box, use the following configuration
4. After completion, continue to install some commonly used PHP modules.
Please execute the following instructions:
# cd /usr/ports/lang/php5-extensions/
make install clean
In the pop-up prompt box, use the following configuration
A menu appears. In addition to the default items, we must select the following commonly used items: CTYPE, CURL, EXIF, FOLTER, FTP, GD, GETEXT, GMP, MBSTRING, MCRYPT, MYQL, PDF, IMAP, PCRE, SESSION, SOCKETS, ZLIB, ZIP. These projects are very commonly used, especially SESSION.
Then a menu will appear, just keep the default:
Then select this:
After all, this is what foreigners "want" Chinese people to use.
After the installation is complete, run cp –rp /usr/local/etc/php.ini-dist /usr/local/etc/php.ini #php5