ThinkPhp 学习笔记(一)
2014-11-19 00:00
218 查看
摘要: 一个网卡配置多个ip地址,apache就 基于多个ip 地址配置virtural host 整个号apace php thinkphp
整合PHP 框架
因为我的php 里配置恩几个主机,所以参考了网上资料 配置基于多IP地址配置virtural host
1 环境
redhat linux, php5.5 apache 2.2
2. 一个网卡添加多个ip地址
该主机目前只有一个eth0
执行
在用ifconfig 命令查看
eth0:1 在电脑重启时就会自动消失
这里可以把这个命令
添加到rc.local
3. 解压thinkphp 包
解压到如下目录(注意此处我已经修改了Application 读写权限)
4.配置apache httpd.conf
5 报错
应用目录[./Application/]不可写,目录无法自动生成! 请手动生成项目目录~
chmod a+w /opt/www/ahcustomer/Application
6 访问地址
http://192.168.2.242/index.php
整合PHP 框架
因为我的php 里配置恩几个主机,所以参考了网上资料 配置基于多IP地址配置virtural host
1 环境
redhat linux, php5.5 apache 2.2
[root@test_1 ahcustomer]# cat /proc/version Linux version 2.6.32-358.el6.x86_64 (mockbuild@x86-022.build.eng.bos.redhat.com) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP Tue Jan 29 11:47:41 EST 2013
2. 一个网卡添加多个ip地址
[root@test_1 php]# ifconfig eth0 Link encap:Ethernet HWaddr 84:2B:2B:94:F7:7D inet addr:192.168.2.241 Bcast:192.168.2.255 Mask:255.255.255.0 inet6 addr: fe80::862b:2bff:fe94:f77d/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:4912690 errors:0 dropped:0 overruns:0 frame:0 TX packets:5260810 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:3889990544 (3.6 GiB) TX bytes:4838872261 (4.5 GiB) Interrupt:18 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:3567 errors:0 dropped:0 overruns:0 frame:0 TX packets:3567 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1752163 (1.6 MiB) TX bytes:1752163 (1.6 MiB)
该主机目前只有一个eth0
执行
ifconfig eth0:1 192.168.2.242 netmask 255.255.255.0 up
在用ifconfig 命令查看
[root@test_1 php]# ifconfig eth0 Link encap:Ethernet HWaddr 84:2B:2B:94:F7:7D inet addr:192.168.2.241 Bcast:192.168.2.255 Mask:255.255.255.0 inet6 addr: fe80::862b:2bff:fe94:f77d/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:4912690 errors:0 dropped:0 overruns:0 frame:0 TX packets:5260810 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:3889990544 (3.6 GiB) TX bytes:4838872261 (4.5 GiB) Interrupt:18 eth0:1 Link encap:Ethernet HWaddr 84:2B:2B:94:F7:7D inet addr:192.168.2.242 Bcast:192.168.2.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 Interrupt:18 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:3567 errors:0 dropped:0 overruns:0 frame:0 TX packets:3567 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1752163 (1.6 MiB) TX bytes:1752163 (1.6 MiB)
eth0:1 在电脑重启时就会自动消失
这里可以把这个命令
ifconfig eth0:1 192.168.2.242 netmask 255.255.255.0 up
添加到rc.local
3. 解压thinkphp 包
解压到如下目录(注意此处我已经修改了Application 读写权限)
[root@test_1 ahcustomer]# pwd /opt/www/ahcustomer [root@test_1 ahcustomer]# ll 总用量 24 drwxrwxrwx 5 root root 4096 11月 19 15:03 Application -rw-r--r-- 1 root root 416 6月 13 09:57 composer.json -rw-r--r-- 1 root root 1009 6月 13 09:57 index.php drwxr-xr-x 2 root root 4096 6月 13 09:57 Public -rw-r--r-- 1 root root 2681 6月 13 09:57 README.md drwxr-xr-x 8 root root 4096 6月 13 09:57 ThinkPHP
4.配置apache httpd.conf
<VirtualHost 192.168.2.242:80> DocumentRoot /opt/www/ahcustomer ServerName 192.168.2.242 <Directory "/opt/www/ahcustomer"> Options Indexes FollowSymLinks IndexOptions Charset=utf-8 AllowOverride All Order allow,deny Allow from all </Directory> </VirtualHost>
5 报错
应用目录[./Application/]不可写,目录无法自动生成! 请手动生成项目目录~
chmod a+w /opt/www/ahcustomer/Application
6 访问地址
http://192.168.2.242/index.php
相关文章推荐
- 【学习笔记】thinkPHP的RBAC的基本用方法
- ThinkPHP php 框架学习笔记
- ThinkPHP学习笔记(八)一个用户增删改查的小例子
- ThinkPHP学习笔记(十六)使用视图(数据库视图)和缓存
- ThinkPHP学习笔记(十三)多模板支持和多语言支持
- ThinkPHP学习笔记(十二)ThinkPHP的分页以及验证码的使用
- ThinkPHP学习笔记1
- ThinkPHP学习笔记(八)CURD的的相关操作以及表的关联查询等
- THINKphp学习笔记2
- ThinkPHP学习笔记(六)实例化模型的四种方法
- ThinkPHP2学习笔记1
- ThinkPHP 学习笔记二 模版
- ThinkPHP 学习笔记
- ThinkPHP学习笔记(七)实例化中create方法的作用,以及令牌的使用
- ThinkPHP 无法显示欢迎界面 学习笔记(一)
- ThinkPHP php 框架学习笔记
- ThinkPHP框架开发学习笔记(一)
- thinkphp学习笔记3
- ThinkPHP学习笔记(二十)模板中使用函数和标签
- ThinkPHP学习笔记(十)在Model中完成自动验证前台的表单数据