- 更新软件源 HELP:http://mirrors.sohu.com/help/ubuntu.html
apt-get install mysql-server nginx memcached redis-server git apt-get install php5 php5-fpm php5-memcache php5-memcached php5-mcrypt php5-mysql php5-dev php-redis curl php-curl
- 下载https://github.com/nicolasff/phpredis 并安装(http://www.cnblogs.com/kingcat/archive/2012/02/27/2369535.html)
- apt安装apc
- 在php.ini里添加extention=扩展名,扩展有
extension = "memcached.so" extension = "redis.so" extension = "apc.so" extension = "curl.so"
- 从svn里边checkout项目
- 到http://www.yiiframework.com/ 下载yii最新的框架,讲项目里的index,php里边的yii路径更改正确,并将YII路径加入php.ini里边的 include_path
- 配置Nginx的配置文件
server { root /home/user/www/项目名称; index index-test.php index.php index.html index.htm; server_name 项目域名; location / { try_files $uri $uri/ /index.php?$args; #注意这个地方入口文件是index-test.php就写index-test.php } location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ { expires 24h; log_not_found off; } # Block for processing PHP files # Specifically matches URIs ending in .php location ~ \.php$ { try_files $uri =404; # Fix for server variables that behave differently under nginx/php-fpm than typically expected fastcgi_split_path_info ^(.+\.php)(/.+)$; # Include the standard fastcgi_params file included with nginx include fastcgi_params; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_index index.php; # Override the SCRIPT_FILENAME variable set by fastcgi_params fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; # Pass to upstream PHP-FPM; This must match whatever you name your upstream connection # for debug need long time send_timeout 600; fastcgi_read_timeout 600; fastcgi_send_timeout 600; fastcgi_pass 127.0.0.1:9000; } }
- vim /etc/hosts文件,把你的域名解析到你自己的机器,一般是加入(127.0.0.0你的域名)
- 配置yii里的urlManager(一般检出的项目里边有)
'urlManager' => array( 'urlFormat' => 'path', 'showScriptName' => false, 'rules' => array( '<controller:\w+>/<id:\d+>'=>'<controller>/view', '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>', '<controller:\w+>/<action:\w+>' => '<controller>/<action>', ), ),
- 新建/protected/runtime 和/asset目录,并赋予可读写权限
- 这样就可以通过域名访问页面了
LAMP环境配置+yii配置
最新推荐文章于 2023-08-23 14:13:49 发布