配置PHP的web服务

上一篇 / 下一篇  2011-03-02 18:59:55 / 个人分类:自动化测试

1. 首先需要将自己写的PHP(first.php)程序放入/var/www/host/.   比如域名起为 automation.xx.com. 则需将php程序放入/var/www/host/automation.xx.com/first.php
2. 然后进入 /usr/local/nginx/conf/sites-enabled ,拷贝一个conf到 automation.xx.com.conf,进行相应修改。然后拷贝到/usr/local/nginx/conf/sites-enabled/
  server {
        listen       80 ;
        server_name  automation.dangdang.com;
        index index.html generate_product_ids.php;
        root  /var/www/hosts/automation.xx.com;

        location ~ .*\.php?$ {
            include     fastcgi.conf;
        }

   location ~ .*\.aspx?$ {
       rewrite ^(.*).aspx?(.*)$ $1.php?$2 last;
    }
    location ~ .*\.dll?$ {
      rewrite ^/* /404.php;
    }
    location ~ .*\.inc?$ {
      rewrite ^/* /404.php;
    }
    location ~ ^/shoppingcart/.*\.aspx?$ {
       rewrite ^/shoppingcart/([0-9a-z_]+)\.aspx$ /shoppingcart/$1.php;
    }      
           
    }
~                                                                                                                                                                                                                                            

3. 最后重启一下 httpd.   service httpd restart. 即可 通过。http://automation.xx.com/first.php来进行访问。(记得修改本机Host)

TAG:

 

评分:0

我来说两句

Open Toolbar