Web server build and Setup

Source: Internet
Author: User

First, load the Web server required software, set the server IP is 192.168.1.2
1. Set IP

ifconfig192.168.1.2

2. View IP

ifconfig

Second, in the IP address of the Web server 192.168.1.2, for the system of XXX users set personal home page space. The user's home directory is/home/xxx, and the directory where the profile space resides is www
1. Add the account XXX to the WWW host and change its password

useradd xxxpasswd xxx

2. Set up its personal directory by default in the/home directory/home/xxx

ls /home

3. Edit the/etc/httpd/conf/httpd.conf file and change the following

<IfModulel mod_userdir.c>#UserDir disableUserDir public_html</IfModulel>

4. Create public_html directory under Account XXX home directory/home/xxx

mkdir xxx/public_html

5. Create the index.html file in the public_html directory and write the I am XXX

touch xxx/public_html/index.htmlecho “I am xxx”>xxx/public_html/index.html

6. Restart httpd service, test XXX profile Services

7. Enter the test on the browser

http://192.168.1.2/~xxx

Third, set up the personal page space only enter a valid user name and password to be accessed, the authenticated user name and password are personal names of the full spell and 12345678
1. Configuring the/etc/httpd/conf/httpd.conf File

<Directory “/var/www/html”>Options Indexes FollowSymLinksAllowOverrideAllOrder allow,denyAllowall</Directory>

2. Create the contents of the. htaccess file, and save it in xxx/public_html (directory to access control) to exit

AuthUserFile /etc.secure.userAuthName xxxAuthType BasicRequire valid-user  

3. Create user password file, user name is XXX

htpasswd -c /etc/secure.user xxx

4. Password set to 123456

New password:Re-typenewfor user xxx

5. Restart httpd

service httpd restart

6. Enter the test on the browser

http://192.168.1.2/~xxx

Iv. set 192.168.1.2 and 192.168.1.3 two IP addresses for the Web server. Using these two IP addresses to create 2 IP address-based virtual hosts, requires different virtual hosts corresponding to the home directory, the default document content is also different.
1. Configuration of two ip,192.168.1.2 and 192.168.3

ifconfig192.168.1.2192.168.1.3

2. Edit/etc/httpd/conf/httpd.conf with the following contents:

#NameVirtualHost *:8080<VirtualHost 192.168.1.2:80>    DocumentRoot /var/www/html/12    ServiceName 192.168.1.2</VirtualHost><VirtualHost 192.168.1.3:80>    DocumentRoot /var/www/html/13    ServiceName 192.168.1.3</VurtualHost>

3. Create a directory file, set up a document directory for each IP, and create a home page file index.html

cd /var/www/htmlmkdir121312/index12”>12/index13/index13”>13/index.html

4. Restart httpd, client test 192.168.1.2:8080 and 192.168.3:8080

service httpd restart

Five, the Web server IP address is 192.168.1.2. It is now necessary to create a virtual host based on 8000 and 88,002 different port numbers, which requires different host directories for the respective virtual hosts, and the contents of the default documents are different.
1. Configure IP192.168.1.2

ifconfig192.168.1.2

2. Edit the//etc/httpd/conf/httpd.conf with the following contents:

#Listen12.34.56.78.80//监听端口8000和8800Listen8000Listen8800
#NameVirtualHost *:80<VirtualHost 192.168.1.2:8000>    DocumentRoot /var/www/html/8000    ServiceName 192.168.1.2</VirtualHost><VirtualHost 192.168.1.2:8800>    DocumentRoot /var/www/html/8800    ServiceName 192.168.1.2</VirtualHost>

3. Create a directory file, set up a document directory for each IP, and create a home page file index.html

cd /var/www/htmlmkdir80008000/index.htmlecho “8000”>8000/index.html
mkdir88008800/index.htmlecho “8800”>8800/index.html

4. Restart httpd, client test 192.168.1.2:8000 and 192.168.2:8800

service httpd restart

Web server build and Setup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.