正在加载图片...
ServerName localhost to the file and save.Thiscnall be done ina single command with the following echo "ServerName localhost"I sudo tee /etc/apache2/conf.d/fqdn Virtual Hosts Apache2 has the concept of sites,which are separate configuration files that Apache2 will read.These are available in/etc/apache2/sites-available.By default,there is one site available You can have many different site configurations available,and activate only those that you need. As an example,we want the default site to be /home/user/public_html/.To do this,we must create a new site and then enable it in Apache2. To create a new site: 1.Copy the default websitea starting cp /etc/apache2/sites-available/000-default.con 2.Edit the new configuration file in a text editor"sudo nano"on the command line or "gksudo gedit"for example:gksudo gedit /etc/apache2/sites-available/mysite.c onf 3. Change the DocumentRoot to point to the new location.For example,/home/user/public_html/ 4.In the file:/etc/apache2/apache2.conf,change the Directory directive, replace <Directory /var/www/>to<Directory /home/user/public html/ 5.Youcan also set separate logs for each site.To do this,change the ErrorLog and Cus tomLog directives.This is optional.but handy if you have maiy sites 6.Save the file Nowwe must deactivate activate our newone.Ubuntu providestwo small iies that take re of this ()and a2dissite(apache2disable site) s sudo a2dissite 000-default &4 sudo azensite mysite Finally,we restart Apache2: s sudo /etc/init.d/apache2 restart Ifyou have not created /home/user/public htm1/.you will receive an warning message To test the new site,create a file in /home/user/public_html/: echo '<b>Hello!It is working!</b>'>/home/user/public_html/index.html Finally,browse to http:ocalhost Installing PHP 5 Toony install PHP5.useany method to install the packageServerName localhost to the file and save. This can all be done in a single command with the following: $ echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn Virtual Hosts Apache2 has the concept of sites, which are separate configuration files that Apache2 will read. These are available in /etc/apache2/sites-available. By default, there is one site available called 000-default. This is what you will see when you browse to http://localhost orhttp://127.0.0.1. You can have many different site configurations available, and activate only those that you need. As an example, we want the default site to be /home/user/public_html/. To do this, we must create a new site and then enable it in Apache2. To create a new site: 1. Copy the default website as a starting point. sudo cp /etc/apache2/sites-available/000-default.con f /etc/apache2/sites-available/mysite.conf 2. Edit the new configuration file in a text editor "sudo nano" on the command line or "gksudo gedit", for example:gksudo gedit /etc/apache2/sites-available/mysite.c onf 3. Change the DocumentRoot to point to the new location. For example, /home/user/public_html/ 4. In the file: /etc/apache2/apache2.conf, change the Directory directive, replace <Directory /var/www/> to<Directory /home/user/public _html/> 5. You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites 6. Save the file Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite (apache2enablesite) and a2dissite (apache2disable site). $ sudo a2dissite 000-default && sudo a2ensite mysite Finally, we restart Apache2: $ sudo /etc/init.d/apache2 restart If you have not created /home/user/public_html/, you will receive an warning message To test the new site, create a file in /home/user/public_html/: $ echo '<b>Hello! It is working!</b>' > /home/user/public_html/index.html Finally, browse to http://localhost/ Installing PHP 5 To only install PHP5. use any method to install the package
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有