- 更新軟件源 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配置
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.