Liunx service usage (apche server, web Release)

Source: Internet
Author: User

Have you ever thought about releasing your fun stuff online? Your computer can clearly practice the Internet, but it cannot display the path of your image or webpage to the Internet. Why? Because your webpage or images have not been published, you can solve this problem by learning apahce. I like this service too and it is very interesting.




Httpd


Chkconfig -- the list service is enabled under those levels


NetworkManager 0: Close 1: Close 2: Close 3: Close 4: Close 5: Close 6: Close

Acpid 0: off 1: off 2: Enable 3: Enable 4: Enable 5: Enable 6: Disable

Anacron 0: off 1: off 2: Enable 3: Enable 4: Enable 5: Enable 6: Disable

Apmd 0: Disable 1: Disable 2: Enable 3: Enable 4: Enable 5: Enable 6: Disable

Atd 0: Disable 1: Disable 2: Disable 3: Enable 4: Enable 5: Enable 6: Disable

Auditd 0: off 1: off 2: Enable 3: Enable 4: Enable 5: Enable 6: Disable

Autofs 0: Disable 1: Disable 2: Disable 3: Enable 4: Enable 5: Enable 6: Disable

Avahi-daemon 0: Disable 1: Disable 2: Disable 3: Enable 4: Enable 5: Enable 6: Disable

Avahi-dnsconfd 0: Close 1: Close 2: Close 3: Close 4: Close 5: Close 6: Close

Bluetooth 0: Disable 1: Disable 2: Enable 3: Enable 4: Enable 5: Enable 6: Disable


Chkconfig -- level 35 dhcpd on open the dhcpd service in 3 5

Chkconfig -- add dhcpd Service (after installing the source package, the Service may not need to be installed as needed)


-----------------------------------------------------------------

Web Service (apache)

Installation Package: process mode by default

Httpd-2.2.3-63.el5.i386.rpm

Configuration file:

/Etc/httpd/conf/httpd. conf

Start the service:

Service httpd restart

To add a data directory:

/Var/www/html/

Touch index.html

Port:

80 443 https encryption)


----------------------------------------------

Process mode processes are mostly used)

100 <IfModule prefork. c>

101 StartServers 8

102 MinSpareServers 5

103 MaxSpareServers 20

104 ServerLimit 256

105 MaxClients 256

106 MaxRequestsPerChild 4000


Thread mode

116 <IfModule worker. c>

117 StartServers 2

118 MaxClients 150

119 MinSpareThreads 25

120 MaxSpareThreads 75

121 ThreadsPerChild 25

122 MaxRequestsPerChild 0


------------------------------

Process mode and thread mode switch:

Vim/etc/sysconfig/httpd

# HTTPD =/usr/sbin/httpd. worker comment out

----

[Root @ localhost sbin] # ls/usr/sbin/httpd

Httpd. event process mode httpd. worker off-the-shelf Mode

Mv/usr/sbin/httpd. prefork

Mv/usr/sbin/httpd. worker/usr/sbin/httpd

Restart the service either way.


Ps-ef | grep httpd: Check the httpd mode.


---------------------------

Publish a webpage based on the user's home directory

<IfModule mod_userdir.c>

# Comment out UserDir disable

UserDir public_html

</IfModule>



Useradd tom

Useradd jerry


Mkdir/home/jerry/public_html

Mkdir/home/jerry/public_html


Echo "tom home">/home/tom/public_html/index.html

Echo "jerry home">/home/jerry/public_html/index.html


Chmod 755/home/xu

----------------------------------------------

View webpages in file Mode

Elinks-dump 192.168.1.2


--------------------

Alias

Alias/down/usr

<Directory/usr>

Options indexes

Order deny, allow

Allow from 192.168.1.0/24

Deny from 10.10.10.10/24 reject

</Directory>



If a rule conflict occurs, the keyword behind the order table read from the back to the back takes effect first.


-------------------------------------

User verification access

Alias/down/usr

<Directory/usr>

Options indexes

AuthType Basic verification type

AuthName "Please insert your name and passwd !!!!!!! "Prompt

AuthBasicProvider file authentication method

AuthUserFile/etc/httpd/passwdb File Location

Require user robin valid user

# Require valid-user all users in the file

</Directory>



Create and add

Htpasswd-c-B/etc/httpd/passwdb robin 123

Htpasswd-B/etc/httpd/passwdb eric 123



-------------------------------------

Publish cgi scripts


ScriptAlias/cgi-bin/"/var/www/cgi-bin /"


<Directory "/var/www/cgi-bin">

AllowOverride None

Options None

Order allow, deny

Allow from all

</Directory>


-------------------------

Touch/var/www/cgi-bin/cgi. sh

Chmod + x cgi. sh

Vim cgi. sh


#! /Bin/bash

Echo-e "Content-type: text/html \ n" fixed format

Uname-

Echo "<br>"

Date

Echo

Cat/etc/passwd


----------------------------------------------------

Virtual Host

Domain name-based host

Vim/etc/httpd/conf/httpd. conf configuration file


NameVirtualHost *: 80

<VirtualHost *: 80>

DocumentRoot/var/www/html/sina

ServerName www.sina.com

</VirtualHost>

<VirtualHost *: 80>

DocumentRoot/var/www/html/sohu

ServerName www.sohu.com

</VirtualHost>


Mkdir/var/www/html/sina

Mkdir/var/www/html/sohu


Echo "sina">/var/www/html/sina/index.html

Echo "sohu">/var/www/html/sohu/index.html


Cat/etc/hosts

192.168.1.2www.sohu.com

192.168.1.2www.sina.com



Ip-based

Vim/etc/httpd/conf/httpd. conf

<VirtualHost 192.168.1.2: 80>

DocumentRoot/var/www/html/sina

ServerName www.sina.com

</VirtualHost>

<VirtualHost 10.10.10.1: 80>

DocumentRoot/var/www/html/sohu

ServerName www.sohu.com

</VirtualHost>


Mkdir/var/www/html/sina

Mkdir/var/www/html/sohu


Echo "sina">/var/www/html/sina/index.html

Echo "sohu">/var/www/html/sohu/index.html


Cat/etc/hosts

192.168.1.2www.sohu.com

10.10.10.1www.sina.com


Port-based

Listen 80

Listen 8080.


<VirtualHost *: 80>

DocumentRoot/var/www/html/sina

</VirtualHost>

<VirtualHost *: 8080>

DocumentRoot/var/www/html/sohu

</VirtualHost>


This article is from the "history_xcy" blog, please be sure to keep this http://historys.blog.51cto.com/7903899/1296664

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.