Apache Quick Deploy Web page

Source: Internet
Author: User

A few months ago to study the architecture and deployment of the next apache2, after a long time to find incredibly completely forget, had to re-write a log for easy access later.

First I use the Ubuntu system, not for anything else, just its handy software installation and uninstallation process makes you irresistible. Especially in the redhat under the struggle for hours, install a successful software, suddenly found in Ubuntu only need a line of command, your heart has a decision. Of course, Redhat also has its own Yum command, but personally feel that it is far from the use of Ubuntu.

1. Installation of Apache2

The word goes forward, first of all the installation of apache2.

Simple sentence: #apt-get install Apache2

After a series of brush screens are complete, the various components of the apache2 are installed in 5 places:

    • Location of the configuration file:/etc/apache2
    • LIB file is here:/usr/lib
    • Startup file Location:/etc/init.d/apache2
    • Web location:/var/www
    • Software Location:/usr/share/apache2

If you are unfamiliar with software installation under Ubuntu, you can refer to: http://blog.csdn.net/lrenjundk/article/details/7082620

2. Apache2 start-up and shutdown

To start and close apache2 you can use the following command:

    • Start:/etc/init.d/apache2 start or Apache2ctl start
    • OFF:/etc/init.d/apache2 stop or Apache2ctl stop
    • Restart:/etc/init.d/apache2 restart or apache2ctl restart
3. Web page Deployment:

Deploying the Web page under Apache2 is also fairly straightforward, opening the configuration file directory first:

#cd/etc/apache2

[email protected]:/etc/apache2# ls
apache2.conf Envvars Magic mods-enabled sites-available
CONF.D httpd.conf mods-available ports.conf sites-enabled

3.1 Apache Parameters:

In this directory, the most important is the apache2.conf file, which contains the main parameters of Apache, including the number of threads that can be configured, the number of processes, the number of users, the number of servers, and so on:

<ifmodule mpm_worker_module>      startservers          2      minsparethreads      maxsparethreads      75      threadlimit      threadsperchild      maxclients      maxrequestsperchild   0  </IfModule>    <ifmodule mpm_event_module>      startservers          2      minsparethreads      -      Maxsparethreads      threadlimit      threadsperchild          maxclients      Maxrequestsperchild   0  </IfModule>    <ifmodule mpm_prefork_module>      startservers          5      Minspareservers       5      maxspareservers      maxclients      maxrequestsperchild   0  </IfModule>  

  

 3.2 Linked pages

To link a page you first need to create your own page in/var/www, where there is already a default page index.html. It works, which is the default after Apache2 startup.

To build your own web site, you first need to create a separate folder to differentiate between different sites and to ensure that they do not affect each other. Of course, Apache can start multiple virtual stations at the same time, which is something.

#mkdir wsclient

#cp/usr/my.html.

So we can go to the second step of Web deployment, open the Apache configuration folder, and we'll find two folders named Sites-available and sites-enabled below. First open the sites-available, which holds the virtual machine configuration information for our website. For our web page, we can create a new file named WSClient and make the following edits

1Namevirtualhost *2<virtualhost *:8080>3 ServerAdmin [email protected]4 5documentroot/var/www/wsclient6<directory/>7 Options followsymlinks8 allowoverride None9</Directory>Ten<Directory/var/www/wsclient> One Options Indexes followsymlinks multiviews A allowoverride None - Order Allow,deny -  allow from all the</Directory> -  -scriptalias/cgi-bin//usr/lib/cgi-bin/ -<directory"/usr/lib/cgi-bin"> + allowoverride None -Options +execcgi-multiviews +SymLinksIfOwnerMatch + Order Allow,deny A  allow from all at</Directory> -  -Errorlog ${apache_log_dir}/Error.log -  -# Possible Values Include:debug,Info, notice, Warn, error, Crit, - # Alert, Emerg. in LogLevel warn -  toCustomlog ${apache_log_dir}/Access.log Combined +  -alias/doc/"/usr/share/doc/" the<directory"/usr/share/doc/"> * Options Indexes multiviews followsymlinks $ allowoverride NonePanax Notoginseng Order Deny,allow -  allow from all the # Deny from all +# Allow from127.0.0.0/255.0.0.0::1/ - A</Directory> the</VirtualHost>

Let's not forget the rest of the content, we need to note that if we bind our original folder to this virtual machine, the key statement:

1 documentroot/var/www/wsclient

Finally, with the virtual machine and website information, you also need to open another folder under Apache sites-enabled, the virtual machine registered to Apache, when Apache started, the virtual machine will start automatically. Our website will be able to stand up and run:

#cd: /sites-enabled

#ln-S. /sites-abailable/wsclient wsclient

When you're done, open your browser, enter localhost or your machine's IP to display the pages you've edited.

Special attention:

Also need to modify the/etc/apache2/ports.conf in the listening port, previously forgot to cause the connection is not

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.