Small Q: In fact, I want to always like a child, do not want to see too many things, listen to too much is not, simply walk through
This simple road, but it backfired, must be like a wall to face the society.
Yesterday, we built a lamp architecture, practiced today to build a simple discuz forum, and then made a
Configuration and now form a local forum.
Download and install Discuz:
wget (Curl-o) Http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip
Or go to Comsenz website to find the
Best downloaded to/data/www
The first and the database put a piece, the second name good to distinguish in the WWW directory decompression
Entry directory: cd/data/www
Moving files: MV upload/*./
Upload all the program files, move them out, and
Delete file: RM-RF upload/readme/utility/Compressed Package
View Apache has no boot: ps aux | gerp httpd
We're going to use the config file for the virtual host, but he's not open yet, so go ahead and open the switch in the Apache master configuration file.
Vim/usr/local/apache2/conf/httpd.conf
Include conf/extra/httpd-vhost.conf find him remove comments (/vhost search)
Vim/usr/local/apache2/conf/extra/httpd-vhost.conf Enter the configuration of the edit virtual host
Decumentroot = location path for "/data/www" Discuz
ServerName = www.test.com can be customized with a domain name
Serveralias = alias of the domain name other comments or delete is good, do not use
/USR/LOCAL/APACHE2/BIN/APACHECTL-T detect the Apache configuration file format is correct
/usr/local/apache2/bin/apachectl Graceful Reload configuration, you can access the Discuz
Configure the local DNS service/etc/hosts join format: IP domain name alias
DNS service: Is to ping a domain name, automatically resolve the set of IP
=windows under C/windows/system32/dirves/etc/hosts can be opened with WordPad to set the DNS configuration for Windows Local
I had a mistake at this point, because I didn't go under Wndows to set the IP-to-domain relationship, so the Windows
I can not use the domain name to resolve IP;
Go to master profile /usr/local/apache2/conf/httpd.conf
To change the deny from all to allow for all users to access
Detection -T
Reload Graceful
Windows browser input domain name to start the installation operation, you will find a lot of unusable files
View PS aux | grep httpd discovery files are running as Deamon users
Chown-r Deamon:deamon all unavailable files
Now the next step is to create the MySQL database.
In this we'd better set up a path because the total input/usr/local/mysql/bin/mysql is too long; check for MySQL with no other settings first, or delete it first
vim/etc/profile.d/path.sh
Join the export path= $PATH =/usr/local/mysql/bin
After saving the source!$ a bit, you can use the which view
Enter MySQL
Creating databases: Create DATABASE Discuz
Create User: Grant all on discuz to ' teng ' @ ' localhost ' identhed by ' password '
Go to the website to set up
Complete
Apache User authentication:
Plainly is to give access to the path to set a permission, do not allow no account password to enter;
Create such a path in the WWW directory, such as mkdir AAA
Then CD AAA copies files to verify the operation of CP/ETC/PASSWD./1.txt
Configure the virtual host file (vhost): vim/usr/local/apache2/conf/httpd-vhost.conf
Add the following content format, i.e. add an authentication
<Directory/data/www/aaa>
AllowOverride
AuthName "Zi Ding Yi" appears in the box that logs in to the authentication interface
AuthType Basic
AUTHUSERFILE/DATA/.HTPASSWD the file path where the user's password is stored
Require Valid-user
</Directory>
Because sometimes you need to use the path of Apache2, because there are a lot of commands in this path often used, it is best to give him a path
Add/usr/local/apache2/bin to the last/etc/profile.d/path.sh document you built
Set password command: htpasswd-c/data/.htpasswd user1 Enter the password set below
Add User: htpasswd/data/.htppasswd user2
Do not add-C, or will overwrite the previous user, htpasswd is/usr/local/apache2/bin under the command
Enter the URL, enter the path set above, enter the account password, can be accessed.
To set a default virtual machine:
Sometimes after we set up, there will be some problems, that is, we just set up the Windows Local DNS service on our own computer, is to modify the point of C/windows/system32/dirves/etc/host, you can add the domain name for the specified IP
Then resolve to the site we set up, this is not safe.
The solution is to go to our server's virtual host configuration file , change the default virtual host as an unreachable place, and the default virtual host is the first host;
Vim/usr/local/apache2/conf/extra/httpd-vhost.conf
On top of the virtual host where we set up our own domain name, add a default virtual machine to point to, in the following format:
<virtualhost *:80>
DocumentRoot "/tmp/123" arbitrarily designated directory, set permission to 600 let Deamon inaccessible
ServerName 123.com freely configurable domain name
</VirtualHost>
So as long as we do not add the domain name of the IP locally, the addition of other places is not valid
Domain 301 Jump:
There is another situation, when we set up a number of domain names, the first we do not remember, remember not single-minded;
The second we set a path under a thing, and then enter, the browser is also very confused to go to that domain name;
Therefore, we want to set one of them as the main, when the input other will automatically jump to this primary domain name.
Enter the virtual host configuration file , add an auto jump module, rewrite moudle (shared)
Available /usr/local/apache2/bin/apachectl-m View
The module is placed under the large module of the virtual host, above the authentication module;
Module format:
<if Module mod_rewrite.c>
Rewriteengine on
Rewritecone% (http_host) ^www.teng.com$
(if there are two or more individual names, replace the
Rewritecone% (http_host) ^www.teng.com$ "OR"
Rewritecone% (http_host) ^www.xun.com$1)
Rewriterule ^/(. *) $ http://www.test.com$1 [R=301.L]
</if module>
The regular expression starts with/begins, the back arbitrary, refers to the main domain name www.test.com/behind any path
R301 means permanent jump, set the domain name when it is best to use it, good for the browser;
R302 indicates that the temporary jump L means last, and finally ends.
Summary of issues:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/F8/wKiom1YKqqnAnnkTAAFOky7qQnQ993.jpg "style=" float: none; "Title=" DG. PNG "alt=" Wkiom1ykqqnannktaafoky7qqnq993.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/F5/wKioL1YKqrTTwY93AACnxjXAh1U100.jpg "style=" float: none; "Title=" GDG. PNG "alt=" Wkiol1ykqrttwy93aacnxjxah1u100.jpg "/>
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/F8/wKiom1YKqqmAl2N7AAHn11N9u84239.jpg "style=" float: none; "Title=" Qubie. PNG "alt=" Wkiom1ykqqmal2n7aahn11n9u84239.jpg "/>
Day 18th: Building a basic Discuz forum