apache2 + php5 in ubuntu



sudo apache2ctl configtest

sudo /etc/init.d/apache2 restart

* Restarting web server apache2
apache2: Could not reliably determine the server’s fully qualified domain name, using for ServerName
… waiting apache2: Could not reliably determine the server’s fully qualified domain name, using for ServerName

在 /etc/apache2/sites-enabled/000-default中,里面有这样的内容:

NameVirtualHost *
<VirtualHost *>
ServerAdmin webmaster@localhost

DocumentRoot /var/www/

ubuntu apache2配置详解(含虚拟主机配置方法)

it’s not problem of the DNS, it’s about finding the location of Internet source files. Change the path after ‘DocumentRoot’, for example:

DocumentRoot /home/username/public_html

  •  /etc/apache2下还有一个sites-available目录,这里面才是真正的配置文件,而sites- enabled目录存放的只是一些指向这里的文件的符号链接
  • 如果apache上配置了多个虚拟主机,每个虚拟主机的配置文件都放在 sites-available下,
  • 对于虚拟主机的停用、启用就非常方便:当在sites-enabled下建立一个指向某个虚拟主机配置文件的链 接时,即启用了它;若要关闭某个虚拟主机,只需删除相应的链接即可,根本不用去改配置文件。
  • mods-available、mods-enabled 两个目录:是存放apache功能模块的配置文件和链接的。当我用apt-get install php5 安装了PHP模块后,在这两个目录里就有了 php5.load、php5.conf和指向这两个文件的链接。这种目录结果对于启用、停用某个 Apache模块是非常方便的。
  • ports.conf 设置了Apache使用的端口
  •  Virtual Hosting(虚拟主机)

Apache2 + mod_userdir PHP as plaintext problem

Your /etc/apache2/mods-enabled/php5.conf  file should look like this:

1 <IfModule mod_php5.c>
2     <FilesMatch "\.ph(p3?|tml)$">
3         SetHandler application/x-httpd-php
4     </FilesMatch>
5     <FilesMatch "\.phps$">
6         SetHandler application/x-httpd-php-source
7         </FilesMatch>
8     # To re-enable php in user directories comment the following lines
9     # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
10     # prevents .htaccess files from disabling it.
11     #<IfModule mod_userdir.c>
12     #   <Directory /home/*/public_html>
13     #       php_admin_value engine Off
14     #   </Directory>
15     #</IfModule>
16 </IfModule>

Now just restart Apache and everything should work correctly. Type this command as root user:

1 # /etc/init.d/apache2 restart

host name & domain name

Domain name

Some software expects the system host name to be resolvable to an IP address with a canonical fully qualified domain name.

This is really improper because system host names and domain names are two very different things; but there you have it.In order to support that software, it is necessary to ensure that the system host name can be resolved.

Most often this is done by putting a line in /etc/hosts containing some IP address and the system hostname. If your system has a permanent IP address then use that; otherwise use the address

Name Resolution

Name resolution as it relates to IP networking is the process of mapping IP addresses to hostnames, making it easier to identify resources on a network. How to properly configure system for name resolution using DNS and static hostname records?

DNS Client Configuration

To configure your system to use DNS for name resolution, add the IP addresses of the DNS servers that are appropriate for your network in the file /etc/resolv.conf. You can also add an optional DNS suffix search-lists to match your network domain names.

Below is an example of a typical configuration of /etc/resolv.conf for a server on the domain “example.com” and using two public DNS servers.

search example.com

The search option can also be used with multiple domain names so that DNS queries will be appended in the order in which they are entered. For example, your network may have multiple sub-domains to search; a parent domain of example.com, and two sub-domains, sales.example.com and dev.example.com.

If you have multiple domains you wish to search, your configuration might look like the following.

search example.com sales.example.com dev.example.com

If you try to ping a host with the name of server1, your system will automatically query DNS for its Fully Qualified Domain Name (FQDN) in the following order:

  1. server1.example.com
  2. server1.sales.example.com
  3. server1.dev.example.com

If no matches are found, the DNS server will provide a result of notfound and the DNS query will fail.

  • Up until Ubuntu 11.10, administrator access using the sudo tool was granted via the “admin” Unix group. In Ubuntu 12.04, administrator access will be granted via the “sudo” group.
  • resolvconf is now used to manage /etc/resolv.conf on all Ubuntu systems.
  • The most notable difference for the user is that any change manually done to /etc/resolv.conf will be lost as it gets overwritten next time something triggers resolvconf.
  • Instead, resolvconf uses DHCP client hooks, a Network Manager plugin and /etc/network/interfaces to generate a list of nameservers and domain to put in /etc/resolv.conf.
  • I use static IP configuration, where should I put my DNS configuration?
    • The DNS configuration for a static interface should go as “dns-nameservers”, “dns-search” and “dns-domain” entries added to the interface in /etc/network/interfaces

Static Hostnames

Static hostnames are locally defined hostname-to-IP mappings located in the file /etc/hosts. Entries in the hosts file will have precedence over DNS by default. This means that if your system tries to resolve a hostname and it matches an entry in /etc/hosts, it will not attempt to look up the record in DNS. In some configurations, especially when Internet access is not required, servers that communicate with a limited number of resources can be conveniently set to use static hostnames instead of DNS.

The following is an example of a hosts file where a number of local servers have been identified by simple hostnames, aliases and their equivalent Fully Qualified Domain Names (FQDN’s).	localhost	ubuntu-server	server1.example.com server1 vpn	server2.example.com server2 mail	server3.example.com server3 www	server4.example.com server4 file
Ubuntu Network configuration: https://help.ubuntu.com/10.04/serverguide/network-configuration.html

windows Azure server is coming!

Thanks Dom for his help to set up the Azure for me.

Finally, I got this domain name for my server: http://min-horizon.cloudapp.net/

Now I have these installed:

  • PHP 
  • Apache
  • My SQL (root)

But I need to install

  • Matlab for linux 64-bit system (licence?) TSG said the University licence will cover that in the cloud.

It seems very powerful & cool to run server on the Windows Azure.


【idea bigger than techniques】Windows Azure Toolkit for Android

The toolkits being announced make it easier for developers to simplify the complexity of supporting multiple devices, with a common back-end that uses cloud services to share common requirements like device notifications, authentication, storage and even higher-level services like leaderboards.

  • At the same time, developers can maximize the performance of each mobile device by writing client code that exploits each platform.
  • As more and more mobile applications rely on back-end services, the cloud can become increasingly useful and strategic for developers.

Microsoft Releases the Windows Azure Toolkit for Android

The Windows Azure Toolkit for iOS works in two ways: you access Windows Azure storage directly, or alternatively, can go through a proxy service. The proxy service code is the same code as used in the Windows Azure Toolkit for Windows Phone 7 and negates the need for the developer to store the Azure storage credentials locally on the device.


Windows Azure Toolkits for Devices



1. Azure services Platform是一个基于微软数据中心的Internet云端服务平台,为我们提供了一个实时操作系统和一系列的开发、存储、数据存储、Hosting等服务。更简单地说:Azure微软实现云计算的平台。

2. Azure Platform的结构图


Azure platform包括4个部分:Windows Azure,.NET Services,SQL Services,以及微软早就提供出来的Live Services.

你所开发的应用程序,可以被多种客户端使用。可以放在你自己的服务器,也可以通过Windows Azure提供的服务,部署在云端。不管你的程序在“平地”还是在“云端”,它们都可以调用Azure Platform提供的其他各种服务。

在微软MIX09大会上,Windows Azure发布了它的第3个版本——Match 2009 CTP。从这个版本开始,Windows Azure开始支持FastCGI(也就是意味着支持PHP、Ruby、Python等当前流行的”非微软”web应用程序)在Windows Azure中使用PHP

3. Windows Azure应该怎么用?它到底比一般的虚拟主机牛在哪儿?

部署到Windows Azure上的程序扮演着以下两种角色:Web RoleWorker Role

  • Web Role:提供Web服务的角色。
    • Web Role就是ASP.NET Applicantion,是你本地ASP.NET Application的云端版本!支持HTTP/HTTPS协议,还能提供WCF服务。
  • Worker Role:在后台运行的应用程序。一直在云端悄悄运行
    • 它可以在后台访问任何网络资源、数据源并进行操作。
    • 它从来不在大庭广众前露面(不开放外部访问接口),
    • 它接到命令后会毫无怨言地依次执行(Queue service里的消息队列能引导它的工作),
    • 它就像一个默默无闻的无私奉献者。
    • 可以拿Windows系统服务跟它类比,一旦启动,一直在后台运行。这个功能是一般的虚拟主机无法提供的~ 就连Google引以为豪的云平台Google App Engine,至今已经更新了许多许多次,也从来没有考虑过让一段程序在后台长期运行!


  • 在云上——不需要本地服务器;云很大——计算量可以很大;
  • 无论在哪里,一抬头就是云——云平台上的应用无论在哪里、使用何种设备都能使用;
  • 躲在云里——它的计算过程无论有多复杂,地面上的使用者不需要看到它。

4. Web Role和Worker Role附件

  1. 把Local Storage作为缓存使用
  2. 标准的Event Streams记录日志、发出警告
  3. 健康报告

5. Service Definition

Windows Azure使用了一类后缀.csdef的文件来定义服务。包括:这个服务到底似乎Web Role还是Worker Role?使用HTTp还是HTTPS ? 哪里去找Local Storage这个亲家来帮忙?诸如此类的信息。


6. Service Configuration

Web Role和Worder Role 具体应该怎么做呢?


7. .NET Services 概述

与普通的服务不同,云端服务(cloud-based services)需要更多的管理和约束


.NET Services首先是Services,我们可以在portal里对它们进行配置和管理,同时在程序里使用他。另外,和SQL Services一样,.NET Services不仅可以被云端程序使用,普通的应用程序也可以使用它。.NET Services首先是Services,我们可以在portal里对它们进行配置和管理,同时在程序里使用他。另外,和SQL Services一样,.NET Services不仅可以被云端程序使用,普通的应用程序也可以使用它。

.NET Services包括三个部分:

  1.  Access Control:
    • 随着应用程序越来越复杂,角色越来越多,控制用户的access权限变得很重要。
    • 主流的解决方案是让用户提供token,应用程序根据token去判断权限。
    • 规定了自己的一种基于token规则。配置用户权限、识别token判断用户权限这些事再也不需要程序员自己来做了!Access Control会帮你完成得很好!
  2. Service Bus:
    • 把”Service”放在”Bus”里。
    • Service Bus就是把Web Service的EndPoint封装在一起,方便客户段使用者发现可以使用的Web Service,这就是Service Bus的主要功能。
    • Service Bus还有一牛x功能:网络地址转换和穿防火墙
  3. Workflow:.NET Services提供的Workflow服务很容易理解:就是把平时大家用的本地WF逻辑运行在云端。



Just another WordPress.com site

Jing's Blog

Just another WordPress.com site

Start from here......







Just another WordPress.com site

Where On Earth Is Waldo?

A Project By Melanie Coles

the Serious Computer Vision Blog

A blog about computer vision and serious stuff

Cauthy's Blog

paper review...

Cornell Computer Vision Seminar Blog

Blog for CS 7670 - Special Topics in Computer Vision


Life through nerd-colored glasses

Luciana Haill

Brainwaves Augmenting Consciousness



Dr Paul Tennent

and the university of nottingham

turn off the lights, please

A bunch of random, thinned and stateless thoughts around the Web