FreeBSD 5.2.1R Web Server Extraction Example Process

xiaoxiao2021-03-06  119

FreeBSD 5.2.1R Web Server Extraction Example Process

Willy

This document gives the friends who come into contact with FreeBSD as they.

I am more embarrassing this person, but I have always been confident. Because I want to instigate a web server, I know that FreeBSD is more stronger in this regard, so they are determined to prepare to engage a self-itbsd web server. It used to play MS's Windows series, starting freebsd, of course, some touching the door, the following is some of my preliminary experience about FreeBSD, hoping to help later newcomers. I am also a rookie of FreeBSD, everyone is bare. The following text is not a note for me. When I am afraid that I will have an omission in some links in the future, so I will become this article, please also ask the hipster ax.

First, the basic requirement to play freebsd this Unix type operating system, I think it first needs to have the following two basic capabilities, otherwise it will be very difficult. 1. Good English ability. Although FreeBSD also has a graphical interface (GUI), if it is a server, more is the command line (like a MSDOS) operation, in the example of the web server here, almost a pure command line job. Therefore, English is important. 2. UNIX foundation. Basic UNIX instructions To know, such as LS, PWD, CP, MAN, RM, MKDIR, RMDIR, etc. In particular, we must know the role of the Man command. Also knowing that Scroll Lock and More Directions are required when the screen shows too much. The following is a simple example of the usage of several instructions. LS (Column Directory, Dir) LS | More (Column Directory, Using Pipes and More Command Split Screen Shows Excessive Content) CP ABC ABC_BAK (Copy of File, Copy Similar to MSDOS) CP -R ABC ABC_BAK (Catalog Copy) RM -R ABC / * (all files and subdirectories under the subdirectoric ABC, similar to the MSDOS DEL, but allowing the -R option to operate for subdirectory) Man Ls (detailed description of the LS command) ) Mv abc ../ABC_BAK (Mobile and rename ABC for the ABC_BAK under the parent directory, ABC can also be a document for the document) 3. There is a bookD handbook, the paper version is of course good, electronic version is also good: http: http: http: http: //www.freebsd.org.cn/snap/doc/en_cn.gb2312/books/handbook/

Second, some statements before installing the system first declare that I am using the latest FreeBSD5.2.1Release ISO format disc installed, now the burner is all over, and you downloaded ISO from the Internet. I use a disc to install freebsd, should not be What is difficult. Second, FreeBSD's full installation upgrade requires a good network environment, even if you have a disc, you still need to go on the Internet, so you have a fast internet connection.

Third, the installation process and the premature note 1. Although the installation of the operating system has said a lot of difficulties about FreeBSD, in fact, if you have better English, you will find the freebsd kernel system is still very simple. A total of 30 minutes. And FreeBSD5.2.1 is sufficiently advanced, and my server has not encountered any problems all correctly identified. FreeBSD 5.2.1 has a total of 4, one of which named boot, and its ISO named DISK1 (notice is not bootonly), boot disc plas into the optical drive, BIOS set the optical drive start, restart the machine, the machine Start from the optical drive and enter the kernel of FreeBSD 5.2.1 and automatically start the SysInstall program in the CD. The program is a text graphical interface and is also very friendly. First, select Standard installation, which is also recommended installation mode. There is also a MINI installation, the installed system is the smallest, the run is the highest, but it may be facing more adjustments. A. Hard disk partition and UNIX partition quota are assigned as an initiator, choose the Standard mode installation, then entered the FDISK program interface of FreeBSD, and MSDOS's fdisk is very similar, but the prompt below the screen is more friendly. If you have two or more hard drives, FDISK will ask you to do partitions on that hard disk. Since I am doing a server, there is no dual system, etc., so select the existing partition with the upper and lower arrows and press the D key to remove these existing partitions to make a empty disk, then press A to automatically assign into a nature, and finally Press Q to exit FDISK, so simply divide a hard disk area. Then SysInstall will prompt your server if you need to use bootmgr, if you don't need multiple boot, you can choose Standard, I choose Bootmgr - allowed multiple boots in this place. Then use DiskLabel to create a UNIX partition and assign partition space. This picture is similar to fdisk, you can use the up and down direction keys to select the required partition, then click the prompt to the screen and divide the partition according to your own requirements. I use the default method here: choose A automatic division, choose Q to exit. Special Tip: MySQL installation will be installed to / var partition by default. If you don't want to change the default installation of MySQL, then you should adjust the automatic division / var partition, more adjustment. / VAR partition is only 256m by default, and a slightly large database is not enough. I didn't use the default installation partition / var in the MySQL installation below, but changed to the / usr partition, so I didn't need to change any partition size here. B. Tips for the installation process Select the partition and quota completion, then the package selection screen will appear, you can choose developer or anything else. As a web server, I think it is better to choose developer, but I didn't understand it at the time, I didn't choose anything, I didn't choose exit. In fact, it is not necessary to choose, there is still a chance behind it. The subsequent picture is prompted from what media installation, we are of course yourself ISO CD - choose CD / DVD, machines don't start, and other media are actually not selected. After the media is selected, the screen prompt: user confirmation requested

Last Chance! Are you sure you want to continue the installation?

When you are confirmed, the previous partition settings will take effect, and the original things in the hard disk will be deleted and start the initial kernel system.

The initial kernel installation is very fast (10 minutes), and has most popular hardware, I use FB5.2.1 a smooth recognition of all hardware. Subsequently after installation settings, you will first ask if you take PPP / SLIP mode connectivity network, if you don't choose No, I am ADSL's DHCP mode Internet, so NO. If you are a dial mode, let it be based on the prompt.

Then you ask you to enter the TCPIP settings of your network card. If it is DHCP, connect the network cable, the machine will automatically get the settings. If it is a static IP, you can set IP, mask, gateway, DNS, etc. according to your own machine.

Then the machine will ask the following questions:

Whether to set the machine to gateway Gateway - No (We are web server, not gateway)

Whether to set the machine for the inetd super server - NO (we have SSH and Pureftpd, no inetd)

Is it set to NFS Server / Client - NO (we are not this)

Is it set to anonymous ftp - no (we don't need this purpose)

Do you need to set SSHD - YES (we will pass this more secure mode remote control server)

Select time zone - according to the prompt selection, you will prompt you for Beijing time abbreviation is "CST"

Do you need Linux compatibility --yes (maybe I will install some Linux software for the server, such as CS Server)

Do you need to set the system console - the default is very good, you don't have to change it.

Do you need to configure a mouse - NO (I can't see what is necessary to configure the mouse as a hosted Webserver

Do you need to add a user - add one, add a message according to the prompt, so that the user group is written as a WHEEL so that you can use this user to remotely log in to the server. SU to root. After adding this user, you will ask you to have the root password, you can enter. If you don't add a user, let you set the root password.

In fact, these installations are set up, as long as the English is good, according to the prompt, there will be no problem.

C. After installation, Package and Contribution selection

After installation, you can enter the SysInstall's Configure to perform the final package and the Contribution selection.

Package is a binary package that has been compiled and can be run directly. After the default standard is installed, as WebServer, I see the CVSUP (online upgrade) and the unzip under Archivers (some zip packs may be used). Two packages under NET. After selecting the installation, install them in the system.

Then go to the Contibution installation code. It is highly recommended that you have to select all SRC code. There are many categories under SRC, even GAME. When I learned FreeBSD, I was always lacking this one. Later, I learned it. After I installed the SRC, it was a lot, and I rarely prompted when compiled, and the future CVSUP is also beneficial. The other is Ports, don't say, it is also full. I am here, that is, I chose SRC and Ports. After selecting the installation, install them into the system.

At this point, an initial freebsd5.2.1 is installed. Although it looks more, it is actually 30 minutes. If you are the first time I installed freebsd, don't worry about it, you can first look at the manual, familiar with how to familiarize freebsd. 2. The first step after the system is installed, is CVSUP, immediately synchronize your SRC source code and Ports code. For more details on CVSUP, please see the CVSUP section of the FreeBSD manual, which I only introduce the process in this example. Since CVSUP requires an internet environment, you need to pick up your network cable. Enter the following directory:

#CD / USR / SRC / Share / Examples / CVSUP

The inside is a few CVSUP's supfile example. We can modify these examples directly for us. First edit Standard-Suppirl, this file is an example file for upgrading the kernel source code. I personally like to edit the file with EE (because there is a prompt, and use the habit close to Windows), enter the following instructions:

#ee standard-suppile

Can see a lot of things inside, but don't change it, it is specified by default to upgrade all system source code - this is good. We only need to modify a place, find the following line:

* Default host = change_this.freebsd.org

Change to the designated FreeBSD official CVSUP server:

* Default host = cvsup.freebsd.org

Or faster domestic FreeBSD CVSUP server:

* Default host = cvsup.cn.freebsd.org

* Default host = cvsup.freebsdchina.org

Exit and save, run the following instructions to start CVSUP online upgrade code:

#CVSUP Standard-Supfile

This is also our first time with freebsd. If the network is unblocked, you can see the connection prompt and start the automatic upgrade source code. If you are not smooth, or if the CVSUP server is busy, you can try it to try a CVSUP server. If it is a network setting problem, you can change the NIC settings in sysinstall - configure - networking. You can also edit the /etc/rc.conf this file with EE to check the problem.

System source code upgrade, my ADSL can be done by 30 minutes.

Then we upgrade the Ports code. Many things in Ports are unsuitable, we can edit it slightly. Open the Ports-Suppirl this file:

#ee ports-support

First, it is still a specified CVSUP server, and the method of the server is changed according to the method mentioned above. Then choose the Ports tree that needs to be upgraded. As a webserver, upgrade all Ports is completely unnecessary, so you can

Ports-all

The front of the line is added # 注释. Continue to find, there are a lot of Ports branches, we will open the need to open, no need to keep the #, it is canceled. For example, the following lines are added to the #, it is useless to WebServer; I have left the leader #, or leave it, so as not to compile the problem:

Ports-base

# ports-arabic

Ports-archivers

# Ports-astro

# Ports-Audio

# ports-benchmarks

# ports-biology

# Ports-CAD

# ports-Chinese

Ports-comms

Ports-conveilters

Ports-DatabaseSports-Deskutils

Ports-wevel

Ports-DNS

Ports-editors

Ports-emulators

# ports-finance

# ports-french

Ports-ftp

# ports-games

# ports-german

# Ports-graphics

# ports-hebrew

# ports-hungarian

# Ports-IRC

# Ports-Japanese

Ports-Java

# Ports-Korean

Ports-lang

Ports-mail

Ports-math

# ports-mbone

Ports-Misc

# ports-multimedia

Ports-net

# ports-news

# Ports-Palm

# ports-picobsd

# ports-polish

# Ports-portuguese

Ports-print

# Ports-Russian

# ports-science

Ports-security

Ports-shells

Ports-sysutils

Ports-textproc

# Ports-Ukrainian

# ports-vietnamese

Ports-www

# ports-x11

# ports-x11-clocks

# ports-x11-fm

# ports-x11-fonts

# ports-x11-servers

# Ports-x11-Toolkits

# ports-x11-wm

After compiling above, you can save exit and then run the CVSUP to start upgrading Ports:

#CVSUP PORTS-SUPFILE

This upgrade process is about 30 minutes. At this point, all code upgrades are completed.

3. Make World and custom kernel. Regarding the details of Make World, you should also read the relevant part of the manual, and continue to introduce the situation in this example. After the upgrade is completed, the Make World is required. Since our system is just installed, clean, so there is not so much problem. enter:

#CD / USR / SRC

#make buildworld

Will start a compilation process for about 30 minutes, if there is no problem with compilation, continue:

#make installworld

You can update the system as the latest version, then you can restart the machine.

Here you need to declare that because 5.2.1 is the Current branch, Make World does not necessarily always succeed. If you can succeed, congratulations. If it is not successful, the CVSUP system source code can be successfully passed, and it may be successful. I installed 2 server myself, the first one was not successful, and the second one was successful after a month. No success, don't worry too much, after all, 5.2.1 is Release, relatively stable.

Down, we need to customize the kernel. The necessity of custom kernel I want to say that I don't have to say, you should also look at the relevant part of the manual. Also please see this post carefully: http://www.freebsdchina.org/forum/viewtopic.php?t=1706 is very detailed. Specific operation, enter the following directory:

#CD / USR / SRC / SYS / I386 / CONF

Can see a file called Generic. Copy this file a copy, such as Samplekern, which will be the profile of your future kernel.

#cp generic samplekern

#ee samplekern

Edit the Samplekern with EE, follow the posts mentioned above, according to your own hardware situation, software needs edit, start compiling the kernel. Since our CVSUP is over, it is compiled by the "new" method mentioned in the manual. #CD / USR / SRC

Make buildkernel kernconf = Samplekern

This compilation process is about 20 minutes. Don't worry about install, you will be on the old kernel, so as not to be unexpected.

#CD / boot

#cp -r kernel kernel.old

Then install the kernel:

#make installkernel kernconf = Samplekern

After installation, you can restart.

Since I was installing the server at home, I added the following lines to the kernel file to form a shared Internet access.

#ipfirewall for nat

Options ipfirewall

Options ipdivert

Options ipfirewall_default_to_accept

Options IpfireWall_Verbose

Options ipfirewall_verbose_limit = 100

Then in /etc/rc.conf also add a few lines:

# for natd

Gateway_enable = "yes"

FireWall_enable = "YES"

FireWall_Type = "open"

NATD_ENABLE = "YES"

NATD_INTERFACE = "EM0"

NATD_FLAGS = ""

After the above 2 is modified, compiling and install the kernel, you can implement a shared Internet. FreeBSD is a gateway, Windows to do a workstation, and subsequent work can be made from the workstation to log in with SSH, and does not affect the workstation on the Internet. After all, FreeBSD has a lot of adjustments from the installation to the truly input. The general server-specific motherboard is integrated with 2 NIC. Common Intel100M card device code is FXP, Intel1000M card is EM, card code can be seen in sysinstall when you install the system, you can see it in sysinstall - configure - networking. In this example, two cards are 1000m card, the first network card is EM0, and the Internet is connected.

4. Server software installation new thin kernel compilation is completed, it is installed. It is recommended to install it in the order below. Before installing the software, it is recommended to

#ee /etc/make.conf

Add below in the file:

Master_site_override = ftp: //ftp.FreebsdChina.org/pub/freebsd/ports/distfiles/$ {dist_subdir}

Specifying Ports software first downloaded from China. Otherwise all software downloads abroad, sometimes it is not.

A. Mysql 4.0 installation

I chose mysql4.0, not old, not new. When the second time was installed, Ports had reached a version 4.0.20. In this case, in this example, specifically explanation. As mentioned earlier, MySQL default database is placed in / var partition, if your database is very big, then you need to divide / var zone to a large enough. LDCONFIG Boss recommends 4G. If you want to put the database to / usr partition like me, then:

#mkdir / usr / dB

Building a database directory in / usr, then

#CD / USR / PORTS / DATABASES / MYSQL40-Server

#ee makefile Open Makefile, find

DB_DIR? = / Var / db / mysql

Change to

DB_DIR? = / Usr / db / mysql

Subsequently, according to this post, according to the Delphij old teachings, in the front of the air line in front of the configure_target in Makefile, add two line optimization options:

Build_optimized = YES

Build_Static = YES

Save exit editing. then

#make

#make install

Start downloading and start installing the database. After the compilation is installed, the restart machine can start the MySQLD daemon, you can

# mysql

If you can see it

MySQL>

The prompt is installed. However, the just-installed MySQL default database connection is 100, which is far from cope with the requirements of the big website. In accordance with this approach:

http://www.fanqiang.com/a2/b1/20010705/140800801.html

Specifically to the mysql4.0 for freebsd5.2.1 in this example, the number of connections should be modified:

#ee / usr / local / bin / mysqld_safe

Look down to Chapter 312 (version 4.0.20 is 314 line), its line is very long, starting with "$ nohup_nicness", ending with ">> $ ERR_LOG 2> & 1". The row is nestled in an IF statement. In the end of 312, ">> $ ERR_LOG 2> & 1" before, "-O MAX_CONNECTIONS = 1000", (note that each of the front and then leaves a space).

Then find 314 lines down, and it is also a long line, starting with "Eval" $ nohup_nicness "," >> $ Err_Log 2> & 1 "end. Similarly," >> $ Err_Log 2> & 1 "beforehand" - O Max_connections = 1000 ".

Save exit. Then restart, the mysql40 at this time is 1000 concurrently connected databases. You can check with the following method:

#CD / USR / local / bin

#mysqladmin -uroot -p variables

A long list will be played, and the screen is scrolled up and the screen can be seen.

| MAX_CONNECTIONS | 1000 |

Then indicate that the maximum concurrent connection has been modified to 1000.

At this point, the mysql database is installed.

B. Apache2 installation is the same, from ports to apache, there will be no difficulties:

#CD / USR / PORTS / WWW / APACHE2

#make

#make install

complete. It's that simple. Compilation may ask the relevant software GetText installation options, complete it. When compiling, you may be prompted to install the new version of the TextProc / Expat2 error because the old version of Expat2 has been in the machine. Just delete the old version to reinstall the new version of Expat2:

#CD / USR / PORTS / TEXTPROC / EXPAT2

#make deinstall

#make install

#CD / USR / PORTS / WWW / APACHE2

#make

#make install

Continue Make.

C. Apache2 MOD installation Apache2 comes with SSL, so there is no need to install SSL. MOD_GZIP can't find an article about Apache2, is it no need to install, it is strange. So the remaining is Fastcgi and PHP. Sample, first picking fastcgi for apache2, first see post: http://bbs.chinaUnix.net/forum/viewtopic.php?t=221295 Input instruction: #CD / usr / ports / www / mod_fastcgi

#make with_apache2 = yes install

OK, complete it.

It is PHP down.

#CD / USR / PORTS / WWW / MOD_PHP4

#make

Then download compilation, and you will prompt you to choose the compile configuration option. MySQL has been selected by default, and the GD and OpenSSL are also selected. Other options I don't know what to use, I haven't chosen. Subsequent

#make install

PHP4.3.6 is installed.

D. WEB installation After setting First, set the Apache's PHP access capabilities.

#CD / USR / LOCAL / ETC / APACHE2

#ee httpd.conf

Adding the following 3 lines after addtype application / x-gzip .gz .tgz:

#PHP Support

AddType Application / X-httpd-php .php

AddType Application / X-httpd-php-source .phps

Then set the website default boot page Allow INDEX.PHP. Also in httpd.conf, you don't have to exit. turn up

DirectoryIndex index.html index.html.var

Add index.php to:

DirectoryIndex index.php index.html index.html.var

Set the Apache default character set to Simplified Chinese. turn up:

AddDefaultCharset ISO-8859-1

Change to

AdddefaultCharset GB2312

In addition, a website with a large number of visits, Apache default 150 connections must not work. Please modify according to this post: http://www.cnfug.org/journal/3/02.html The specific operation is as follows. Search: After finding this, the recommended value according to the above post is modified to:

STARTSERVERS 10

MinspareServers 10

MaxSpareServers 15

ServerLimit 2000

MaxClients 1500

MaxRequestsperChild 10000

At this point, the setting of httpd.conf is completed. You can save exit. Of course, if you want to engage in virtual hosts, please set the virtual host-related part according to the example of the manual and the httpd.conf tail. For my virtual host settings, you can see the explanation after I have followed by FTP.

Work has not yet finished, set INI to PHP. If there is nothing special requirements, you can use the default recommended php.ini directly.

#CD / USR / LOCAL / ETC

#cp php.ini-recommented php.ini

At this point, restart the machine, HTTP mode accesses this server, such as http://192.168.0.1, you can see the page of Apache2.

At this point, you can write a simple PHP test page in the server default web directory, for example

#ee /usr/local/www/data/index.php

There is only such a line of code inside the file:

At this point, you can see the PHP page information of this unit. After seeing PHPINFO, you can install Zend Optimizer first. Zend Optimizer can only be manually installed, and you can't find it in Ports. After downloading ZendOptimizer-2.5.2-FreeBSD5.1-i386.tar.gz from httore/products/ze-optimizer.php, uploaded to the server in any directory. You can also use a USB flash drive and the burning disk to the server. Then decompress, install:

#tar -zxvf Zendoptimizer-2.5.2-FreeBSD 5.1-i386.tar.gz

#CD Zendoptimizer-2.5.2-FreeBSD5.1-i386

#. / install.sh

Then the Zend Optimizer installation screen appears, step by step according to prompts. Completed, will prompt

X Your php.ini is relocated to the: / usr / local / zend / etc Directory X

X and a symbolic link from the former place: x

X /usr/local/etc/php.ini is created. x

x x

X Your Original PHP.INI WAS BACKED-UP TO: X

X /usr/local/etc/php.ini-ze_optimizer.bak x

At this point, you can see http://192.168.0.1/index.php, you can see information about Zend Optimizer in PHPinfo. At this point, the Web section has all installed settings.

E. Pure-ftpd installation Pure-ftpd installation, I fully learn this post: http://www.freebsdchina.org/forum/viewtopic.php?t=10279 The front of MySQL is not seen. Start directly from the Pure-ftpd section. This should be continued in this example.

#CD / USR / PORTS / FTP / PURE-FTPD

#ee makefile

According to the above post, add the necessary configure_args in your makefile, and save the exit EE. In this case, the installation directory is not specified, using the Ports default installation directory.

#make with_mysql = 1 with_lang = Simplified-Chinese Install Clean

The installation will be successfully completed. Continue the following configuration, perform the following, add the configuration file for the Pure-ftpd:

#CD / USR / LOCAL / ETC

#CP pure-ftpd.conf.sample pure-ftpd.conf

#cp pureftpd-mysql.conf.sample pureftpd-mysql.conf

Open the newly generated pure-ftpd.conf, remove the Note of the MySQL database - ready to use mysql as a verification.

Mysqlconfigfile /etc/pureftpd-mysql.conf

Refigure an anonymous login:

Noanonymous Yes

Refer to the allowed to be able to modify the file name:

NoreName NO

Allow login users to use CHMOD instructions

Nochmod no

Users can delete files

KeepallFiles No

Home Dir to automatically create an account

CreateHomedir Yes

Conf is set. Then import the initial value of the database. Paste the following copy of the copy into a text file (there are several errors in the original post), such as ftp.mysql, then perform the following command to import mysql database:

#mysql -u root -p123456

Insert Into MySQL.user (Host, User, Password, SELECT_PRIV, INSERT_PRIV,

Update_priv, delete_priv, recreate_priv, drop_priv, reload_priv,

SHUTDOWN_PRIV, Process_Priv, File_Priv, Grant_Priv, References_Priv,

Index_Priv, Alter_priv) Values

('LocalHost', 'FTP', Password ('123456'), 'Y', 'Y', 'Y', 'Y', 'N', 'N', 'N', 'N',

'N', 'n', 'n', 'n', 'n', 'n');

Flush privileges;

Create Database FTPUSERS;

Use ftpusers;

Create Table Admin (Username Varchar (35) Not Null Default ', Password Char (32) Binary Not Null Default' ', Primary Key (UserName) Type = MyISAM;

INSERT INTO Admin VALUES ('Administrator', MD5 ('123456'));

Create Table Users (User Char (16) Not Null Default ', Password Char (32) Binary Not Null Default', Uid Int (11) Not Null Default '2000', GID INT (11) Not Null Default '2000' , Dir Char (128) Not Null Default ', Quotafiles Int (10) Not Null Default' 500 ', Quotasize Int (10) Not Null Default' 30 ', UlbandWidth Int (10) Not Null Default' 80 ', DLBANDWIDTH INT (10) Not null default '80', Status Enum ('0', '1') Not Null Default '1', Ipaccess Varchar (15) Not Null Default '*', Comment Tinytext NOT NULL, PRIMARY Key (User) , UNIQUE Key User (user) type = myisam;

INSERT INTO `Users` Values ​​('Test1', MD5 ('123456'), 2001, 2000, '/ Home / Test1', 500, 30 80, 5, 1, '*', '*');

After the database is imported, you can't use it, you also need to set upftpd-mysql.conf

#ee pureftpd-mysql.conf

According to the default prompts in the file, modify it, it is very simple. It is also possible to refer to the modification of the post mentioned above. At this time, the revision in the system is all completed. You will now restart the system, you can try Test1 / 123456 to log in to FTP.

Subsequently, we install the PHP-Manager to implement the FTP management of Web mode according to the above posts. Download ftp.zip (Chinese ftp.zip: http://forum3.games.sina.com.cn/upload/39/400/20040615/1025/205182/205182.zip Please download as soon as possible, late, maybe Sina deletes), pass it to the server, then

#mv ftp.zip / usr / local / www / data

#CD / USR / LOCAL / WWW / DATA

#unzip ftp.zip

#ee ftp / config.php

Modify the connection parameters in config.php, and other basically no change. save. Then you can access this Web management page with http://192.168.0.1/ftp/. Log in to the management page, enter your password (this example is 123456), you can see the preset user TEST1, and its status.

4. Some things after the system installation In this example, this web server is used to support 4 to 5 websites or forums. So the above installation process is actually for this purpose. So subsequent useful precautions, here is a brief description. 1. First, if you want to manage the database very convenient, you should install a phpMyAdmin, you can use the ports, it is very simple, and it is also the default in / usr / local / www / data. 2. Second, if you want to make it easier to monitor the server status, you can also install a phpsysinfo, and the ports can be installed, and the same default is in / usr / local / www / data. In this case, when the server will host the / usr / local / www / data, you can use the virtual host that you know. From this virtual host, you can see the status of the entire server, manage the MySQL of the server, add FTP users and hosts. (Ports PHPSYSINFO2.1) Some issues on Intel onboard Gigabit NICs have some questions, downloading a 2.2 version from PHPSYSInfo's website to fix this problem, and 2.2 supports Simplified Chinese.) 3. About new virtual hosts. Follow the PureftPD in this example, whenever you generate an account in the FTP management page, such as web1, then log in to Server with FTP software, Server automatically generates a user named Web1, and at the same time in / home Generate a web1 directory, specifically: / home / web1 (actually / usr / home / web1) If you want to limit Web1 quotas, you can set it in the management page. Then then the web virtual host directory of Web1, of course, in httpd.conf, is also specified as / home / web1 in this class. Simple?

5. Remote control your own web server except for the simple control of the WEB page, which mentioned above mentioned PHPMYADMIN and FTP, you certainly don't have the ultimate extreme remote control ability: ssh2. I am a rookie, I don't have the advice of this thing. In short, this thing is very secure and can be remotely connected to your SERVER's means. I didn't mention SSH in front, and in fact, the third step of self-hitting, after the initial installation of the operating system, we can use SSH to remotely control the server, not only the effect and server's local console The same, and it may be more convenient - because we can use a Win2K computer, it is very convenient to look at the post here, while watching the side, you can use Windows Ctrl-C / V, how good. First, statement, all the basic knowledge about SSH installation and connection can be found in this post: http://www.freebsdchina.org/forum/viewtopic.php?t=10210 Let's follow my practice, Simply talk about the SSH application method in this example. 1. First download the SSHClient client on your Win2k, it is free and it seems to be more useful. http://www.ssh.com/support/downloads/secureeshellwks/non-commercial.html 2. Since the SSH has been selected when we install the operating system, the operating system part does not need to be set, the default will Start the SSHD daemon. 3. When the system is installed, I have prompted whether to add a user, I have prompted to add at least one user, such as your own English name, and this user must be the Wheel group, only the WHEEL group user can switch to switch root. If you didn't add it, then a user who added a WHEEL group now, this user will be your future login to Server. 4. After installing SSHCLIENT on Win2k, you can directly connect your Server, which is logged in with the Wheel group username and its password. After logging in, you can switch, then enter the root password, you can switch to root. 5. The above login method is safe enough, and others can't eave, but there will be vulnerabilities in the future. Since we are still a local LAN mode connection between us and Server, there is no security problem, so we will use the password mode to serve, you can use sshclient to generate a key, turn into a Key method, so it is basically no security Vulnerability. The practice is as follows: Open SSHCLIENT, menu Select Edit - Settings, the Settings dialog box appears. Inside the Global Settings - User Authentications - Keys option, you can see the Generate New button, press after pressing the prompt, but generate a key, put this key file, press the button Upload, you can put this KEY The file is uploaded to the home directory you logged in on Server, the specific location is /Home/yourname/.ssh2. This .ssh2 directory is automatically generated when uploaded. But the freebsd default directory name is .ssh, not .ssh2. Therefore, according to the posts above, we log in to Server with the Wheel group user just mentioned, and do the following:

$ SU

Password:

#LS

Can see a .ssh2 directory inside. Continue below: #mv .ssh2 .ssh

Rename it .ssh

#cd .ssh

# ssh-keygen -x -f yourkey.pub >> Authorized_keys

Enter the SSH directory and import the KEY file that has just been uploaded into the machine's verification file.

At this point, you can already exit SSHCLIENT, log in to your server in key, do not need to enter your password, you can log in directly, and you don't have to worry. The software comes with a SFTP, which is also encrypted, safe.

Sixth, thank you, I have no good saying this rookie. Top these, in the guests, they are pediatrics, laughing. However, in the spirit of Free, I wrote these messy words. Let's make a new couple later. I'm also a little bit of selfishness - give me myself a note.嘿嘿. (Doing your own blog, I didn't think about it. Only by this book, I'm going to see someone's blog. I am currently working in my own Server. Thank you for this: delphij, ldconfig, jayvan, xiaohua, likuku, and a lot I think Friends. They gave me a lot of timely, useful tips, so that I can start this server first in 1 month, thank you very much! !

Seven, postscript - About Apache log polling. The server has been running for a month and a half, and the hard drive is not big, the log problem has a big problem that plagues me. Unfortunately, I still don't quite use cron and cronolog. I have seen the chedong blog these days, and finally do it, share it with you. I do this: First download the cronolog package, pass the SSH to Server, unpack installation, will be very good installed by default.

#tar -zxvf cronolog-1.6.2.tar.gz

#CD cronolog-1.6.2

#. / configure

#make install

Then open httpd.conf

#ee /usr/local/etc/apache2/httpd.conf

Go to the setting part of the virtual host, change the log log to the following way:

Customlog "| / usr / local / sbin / cronolog /yours/log/access%w.log" CommON

ErrorLog "| / usr / local / sbin / cronolog /yoursite/log/error%w.log"

Run the crontab -e directive, add the following two tasks to CRON:

0 5 * * * / bin / rm / yoursite / log / access`date -v-6d /% W`.log

10 5 * * * / bin / rm / yoursite / log / error`date -v-6d /% W`.log

Restart Apache, the logged log will make a backup every day, and only 1 week.嘿嘿.

Appendix A: Important documents for newcomers, their location and their use. /etc/make.conf compiled global control profile, which is very complex, have an example, you can refer to. /etc/rc.conf rc should be the meaning of resources. This file manages the important resources of Server, such as network card settings, daemon enable off, and the function is turned off. /usr/local/etc/rc.d This is not a file, but a directory, which is equivalent to DOS's autoexec, which is automatically performed when the machine is started. At the same time, you have to close the Apache or MySQL, you can achieve the purpose of running the SH Script here. / usr / local / etc 这个 This is also the same as a file, but a directory. Most of the configuration files for the rear loaded software of the non-operating system are placed here. /usr/local/etc/php.ini PHP configuration file. It is easy to copy the php.ini-recommended copy of the directory. /usr/local/etc/apache2/httpd.conf apache2 web server configuration file. /usr/local/etc/pure-ftpd.conf pure-ftpd base profile. /usr/local/etc/pureftpd-mysql.conf pureftPD mysql configuration file. /usr/db/mysql/my.cnf (this is my example, you may be a /var/db/mysql/my.cnf) mysql configuration file. There is an example in / usr / local / share / mysql, namely my-small.cnf ... my-huge.cnf. Copy a suitable place to the above position, I copied my-large.cnf. Appendix B: I haven't thought about it, hehe.

Note: Any reprint or excerned, please retain the author information and indicate the article (Chinese FreeBSD user group http://www.cnfug.org)

related comment

Hellenbill said in July 8, 2004 11:12 AM:

This article is very good, giving me a lot of help.

Joenice said in July 10, 2004 10:33 Pm:

Good!

YHJ1065 said in July 15, 2004 11:33 Pm:

This article is really great. . . . . . . Help me very busy! Thank you! !

WIND315 said in July 23, 2004 01:00 Pm:

I have just begun to start the learner strongly hope to have more articles!

Shegg said in August 6, 2004 07:43 Pm:

Have help !! Xie Xian!

OpenYLX said in August 15, 2004 09:40 Pm:

This article writes very comprehensive. I am a hot loyal enthusiast for FreeBSD. Thank you. I hope to communicate more later.

TNT said in August 21, 2004 02:40 AM:

Good article ~! Top ~

I099 said in August 25, 2004 11:56 AM:

It's really good, it is suitable for my beginner. Help you top.

Guest said in August 30, 2004 11:21 AM:

Can you give your hardware detailed configuration? Thank you

O990 said in September 9, 2004 07:52 PM:

Written very well, let beginners who don't want to learn FreeBSD provide a good configuration process! Support you :)

Vikong said in September 10, 2004 03:49 AM:

That's very good!

Wisdom_wei said in September 29, 2004 05:16 Pm: Excellent!

Forex said in October 20, 2004 02:46 AM:

I think at would intert you: http://www.forex-online-1ow.com/forex, http://www.forex-online-1ow.com/forex-online-1ow.com/forex-trading, http://www.forex-online -now.com/foreign-exchange.

Forex said in October 22, 2004 07:59 Pm:

I think at would intert you: http://www.forex-online-1ow.com/forex, http://www.forex-online-1ow.com/forex-online-1ow.com/forex-trading, http://www.forex-online -now.com/foreign-exchange.

Muyijin said in October 24, 2004 10:54 AM:

I use the MINI version to try it, it will be fine.

转载请注明原文地址:https://www.9cbs.com/read-101903.html

New Post(0)