★ Download Discuz
Mkdir/data/www <== first create a directory to store the website program
Cd/data/www
wget Http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip
Unzip Discuz_x3.2_sc_gbk.zip
[[email protected] www]# ls
Discuz_x3.2_sc_gbk.zip Readme upload utility
①②③
①③ is useless, we can erase it.
[Email protected] www]# MV upload/*
[[email protected] www]# ls
admin.php crossdomain.xml index.php robots.txt upload
API Data Install search.php userapp.php
api.php discuz_x3.2_sc_gbk.zip member.php Source Utility
Archiver Favicon.ico misc.php Static
Config forum.php plugin.php template
connect.php group.php portal.php uc_client
cp.php home.php Readme Uc_server
★ Configure Apache
#Include conf/extra/httpd-vhosts.conf <== The most forward # of this line to make it work
Vim/usr/local/apache2/conf/extra/httpd-vhosts.conf
Remove the second virtual host, leaving only the first one and configuring it
The details are described below:
<virtualhost *:80>
ServerAdmin [email protected] <== Admin mailbox, you can not
documentroot "/data/www" <== Web site root directory
ServerName www.cy111.com <== a custom domain name
Serveralias www.dummy-host.example.com <== Aliases
Errorlog "Logs/dummy-host.example.com-error_log" <== error log
Customlog "Logs/dummy-host.example.com-access_log" Common <== access log
</VirtualHost>
We have two red lines at this time, others can be considered for the time being, you can comment out the its first
[Email protected] www]#/etc/init.d/apachectl-t
Syntax OK Check the configuration file for any problems
[[email protected] www]#/etc/init.d/apachectl Graceful Reload configuration file
[[email protected] www]# curl-x127.0.0.1:80 www.cy111.com Nothing output, indicating that the virtual host is in effect
★ Configure MySQL
[[email protected] www]#/usr/bin/mysqladmin-uroot password ' 123456 ' Set the password for the root user
[[email protected] www]# mysql-uroot-p123456 Login
mysql> CREATE DATABASE Discuz; <== Creating a library
Query OK, 1 row Affected (0.00 sec)
Mysql> Grant all on discuz.* to ' sky ' @ ' localhost ' identified by ' Yueyue ';
Query OK, 0 rows Affected (0.00 sec) <== grant permissions to a local sky user
In the browser access www.cy111.com, start installing Discuz, one of the pages requires us to change the permissions of several directories to support Apache account writable (that is: chown Daemon:daemon data Uc_server/data uc_ Client/data config), after the change is complete, we can perform the next step and follow the required action. Finally, we built a forum.
★ Configure user authentication for virtual host
What is user authentication?
For example, we successfully set up a forum, in which there is a user login, we can login through the user name and password Admin user, login as an administrator can manage the backstage of the forum, this is actually very dangerous things, if you are setting the password is simple or someone maliciously tried out the administrator password, This can cause a lot of damage. At this point we can make a limit to the ***/admin.php URL, after certification before you can enter the admin login page.
User-certified Configuration
Add the following to the virtual host that you added when you previously configured Apache:
<Directory/data/web/test>
AllowOverride Authconfig <== Rules We're going to do user authentication next.
</Directory>
Vim/data/web/test/.htaccess
Add some content:
AuthName "Frank Share Web"
AuthType Basic
authuserfile/data/web/test/.htpasswd
Require Valid-user
Create Apache Authenticated Users
[Email protected] data]#/usr/local/apache2/bin/htpasswd-c/data/www/test/.htpasswd Yue
New Password:
Re-type New Password: <== The first time you add a user needs the-C command, the second time you don't need it.
Adding Password for user Yue
[Email protected] data]#/usr/local/apache2/bin/htpasswd--help
Usage:
htpasswd [-CIMBDPSDV] [-C Cost] passwordfile username
HTPASSWD-B[CMBDPSDV] [-C Cost] passwordfile username password
HTPASSWD-N[IMBDPS] [-C cost] Username
HTPASSWD-NB[MBDPS] [-C Cost] username password
-C Create a new file.
-N Don ' t update file; Display results on stdout.
-B Use the password from the command line rather than prompting for it.
-I Read password from stdin without verification (for script usage).
-M force MD5 encryption of the password (default). <== encryption algorithm using MD5
-B Force bcrypt encryption of the password (very secure).
-C Set The computing time used for the bcrypt algorithm
(Higher is more secure and slower, Default:5, Valid:4 to 31).
-D Force CRYPT encryption of the password (8 chars max, insecure). <== Default
-S force SHA encryption of the password (insecure).
-P do not encrypt the password (plaintext, insecure).
-D Delete the specified user.
-V Verify password for the specified user.
Vim/usr/local/apache2/conf/extra/httpd-vhosts.conf
<directory /data/www/admin.php> <== has quietly changed the previous catalogue to a file, and we tried to write a successful description
Files are also available.
allowoverride authconfig <== Add some content under this line
</Directory>
Join:
AuthName "Hera" <== Hera is a custom name and is displayed as a prompt for authentication
AuthType Basic
authuserfile/data/www/test/.htpasswd
Require Valid-user
Restart Apache Service
Refresh the Web page to authenticate with a previously created authenticated user
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/59/57/wKiom1TQajKRxspZAACxH6CBbGs819.jpg "style=" float: none; "title=" Sss.png "alt=" Wkiom1tqajkrxspzaacxh6cbbgs819.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/59/54/wKioL1TQaxuRJDdXAACuU2__io0876.jpg "style=" float: none; "title=" Bbb.png "alt=" Wkiol1tqaxurjddxaacuu2__io0876.jpg "/>
LAMP (2)--combined with Discuz configuration Apache,mysql Building Forum