首页 > 代码库 > 安装apache+CI

安装apache+CI

 

1.先安装openssl,虽然一般自己用不到https
 
下载安装包,解压
tar -xzf openssl-xxx.tar.gz

看下configure项

harryma@ubuntu:~/openssl-1.0.1j$ ./Configure --helpUsage: Configure [no-<cipher> ...] [enable-<cipher> ...] [experimental-<cipher> ...] [-Dxxx] [-lxxx] [-Lxxx] [-fxxx] [-Kxxx] [no-hw-xxx|no-hw] [[no-]threads] [[no-]shared] [[no-]zlib|zlib-dynamic] [no-asm] [no-dso] [no-krb5] [sctp] [386] [--prefix=DIR] [--openssldir=OPENSSLDIR] [--with-xxx[=vvv]] [--test-sanity] os/compiler[:flags] 

 

这里就用基础选项装一下
./config --prefix=/usr/local/ --shared

make & make install 二连

make & make install (需要root权限)

装完之后看下是否装成功

harryma@ubuntu:~/openssl-1.0.1j$ openssl versionOpenSSL 1.0.1j 15 Oct 2014

 

当然像unbuntu直接用apt-get也ok:

sudo apt-get install opensslsudo apt-get install libssl-dev

 

2.安装apache

下载apache安装包,解压,进目录,执行

./configure --prefix=/usr/local --enable-so --enable-rewrite --enable-ssl --with-ssl=/usr/local/ssl --enable-module=mostmakemake install

安装完成后,去bin目录启动apache

sudo ./apachetl -k start

打开默认地址http://localhost/,如果显示it works证明安装基本成功

 

3.安装ci

直接下载ci的安装包,解压缩到自己指定的目录下面,如/usr/local/ci/,配置以后再配

 

4.安装php5

先尝试编译安装php5,结果要先安装libxml,就先装下

sudo apt-get install libxml-dev

顺便把mod-php5也装了

sudo apt-get install libapache2-mod-php5

再进行php5的比哪一安装

./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-config-file-path=/usr/local/lib --with-mysql 

copy一份配置文件到lib目录

 sudo cp -p /usr/share/php5/php.ini-development /usr/local/php5/lib/php.ini

 

 

5.修改apache配置

需要将apache的目录指向ci目录,同时让apache支持php

修改httpd.conf,主要是路径、权限以及php文件:

DocumentRoot "/usr/local/ci"<Directory "/usr/local/ci">     Options -Indexes FollowSymLinks     AllowOverride None     Order allow,deny     Allow from all </Directory>DirectoryIndex index.html index.php

找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容

AddType application/x-httpd-php .php    AddType application/x-httpd-php-source .phps 

 

httpd-vhosts.conf也加下路径

<VirtualHost *:80>     ServerAdmin harryma@tencent.com     DocumentRoot "/usr/local/ci"     ServerName wepay.oa.com     ErrorLog "logs/wepay.com-error_log"     CustomLog "logs/wepay.com-access_log" common </VirtualHost>

 

这样设置完重启,访问配置的域名,就可以看到ci的默认页了

 

6.修改ci的配置

不过如果将已有的ci框架放进去可能会报错
Your system folder path does not appear to be set correctly. Please open the following file and correct this: index.php
 
在index.php设置system目录和application目录为自己的路径
 
$system_path = ‘/usr/local/php_platform‘;    if(!is_dir($system_path)){        $system_path = ‘../module/system‘;     } $application_folder = ‘../module/application‘;

 

 
进一步设置ci的一些路径配置,配置文件主要在application/config/
设置基础url
vim application/config/config.php

设置$config[‘base_url‘] = ‘http://wepay.oa.com/‘;

在routes.php下面修改默认页设置
$route[‘default_controller‘] = "welcome";
 
其他配置酌情修改

安装apache+CI