溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

CentOS5.2 Apache怎么搭建系統(tǒng)開(kāi)發(fā)環(huán)境

發(fā)布時(shí)間:2021-07-20 08:49:58 來(lái)源:億速云 閱讀:140 作者:chen 欄目:系統(tǒng)運(yùn)維

這篇文章主要介紹“CentOS5.2 Apache怎么搭建系統(tǒng)開(kāi)發(fā)環(huán)境”,在日常操作中,相信很多人在CentOS5.2 Apache怎么搭建系統(tǒng)開(kāi)發(fā)環(huán)境問(wèn)題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”CentOS5.2 Apache怎么搭建系統(tǒng)開(kāi)發(fā)環(huán)境”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!

對(duì)大家推薦很好使用的CentOS5.2 Apache系統(tǒng)之前,像讓大家對(duì)CentOS5.2 Apache系統(tǒng)有所了解,然后對(duì)CentOS5.2 Apache系統(tǒng)全面講解介紹,CentOS Linux的特點(diǎn)和版本CentOS社區(qū)的Linux發(fā)行版本被稱為CentOS Linux,由于使用了由RHEL的源代碼重新編譯生成新的發(fā)行版本,CentOS Linux具有與RHEL產(chǎn)品非常好的兼容性,并且與生俱來(lái)地?fù)碛蠷HEL的諸多優(yōu)秀特性。希望對(duì)大家有用。CentOS5.2 Apache下搭建Ruby on Rails開(kāi)發(fā)環(huán)境 最近看上了Ruby on Rails的敏捷開(kāi)發(fā)技術(shù)了,雖然早已不是什么新鮮玩意了,不過(guò)看著它越來(lái)越流行了,還是想看一看里面的究竟啊, 先從搭建Ruby on Rails的環(huán)境入手吧。

1.CentOS5.2 Apache下安裝Ruby
rails框架也是Ruby做的,自然要先安裝Ruby了,yum install ruby -y確認(rèn)一下Ruby -v

2.CentOS5.2 Apache下安裝RubyGems
RubyGems是Ruby函數(shù)庫(kù)的管理系統(tǒng)在此之前先要導(dǎo)入dlutter軟件倉(cāng)庫(kù)[root@host1 ~]# vi /etc/yum.repos.d/dlutter.repo修改成[dlutter]name=Unsupported RHEL5 packages (lutter)baseurl=http://people.redhat.com/dlutter/yum/rhel/5/$basearch/enabled=0gpgcheck=0確認(rèn)[root@host1 ~]# yum --enablerepo=dlutter list然后直接用命令安裝RubyGems [root@host1 ~]# yum --enablerepo=dlutter -y install rubygems.noarch 確認(rèn)版本[root@host1 ~]# gem --version1.2.0安裝好應(yīng)該是1.2.0的版本,***是1.3.0的,有興趣的朋友可以用源碼編譯升級(jí)

3.rails框架的導(dǎo)入
這個(gè)比較簡(jiǎn)單,直接用RubyGems來(lái)安裝[root@host1 ~]# gem install rails

4.最關(guān)鍵也是比較復(fù)雜的一步是CentOS5.2 Apache下 Web服務(wù)器的導(dǎo)入
關(guān)于Web服務(wù)器的選擇,通常有很多爭(zhēng)議,就Ruby on Rails而言,很多都是采用lighttpd當(dāng)作Web Server,當(dāng)作FastCGI應(yīng)用程序來(lái)跑,但是lighttpd還是很難代替CentOS5.2 Apache的地位,特別是Rails程序以外還有其他Web程序的時(shí)候、不大可能完全移植到lighttpd上的,所以在這里,只是Rails程序跑在lighttpd上,對(duì)Rails程序的請(qǐng)求通過(guò)CentOS5.2 Apache下轉(zhuǎn)送過(guò)來(lái)。先安裝FastCGI
[root@host1 ~]# wget http://www.fastcgi.com/dist/fcgi-2.4.0.tar.gz
[root@host1 ~]# tar zxvf fcgi-2.4.0.tar.gz
[root@host1 ~]# cd fcgi-2.4.0
[root@host1 fcgi-2.4.0]# ./configure
[root@host1 ~]# gem install fcgi
[root@host1 fcgi-2.4.0]# make
[root@host1 fcgi-2.4.0]# make install
[root@host1 fcgi-2.4.0]# cd
[root@host1 ~]# rm -rf fcgi-2.4.0*

下面用RubyGems把Ruby的FastCGI的包導(dǎo)進(jìn)來(lái)接下去就要安裝lighttpd服務(wù)器了,先導(dǎo)入RPMforge 軟件倉(cāng)庫(kù)
[root@host1 ~]# wget http://dag.wieers.com/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
[root@host1 ~]# rpm -Uhv rpmforge-release-0.3.6-1.el5.rf.i386.rpm
[root@host1 ~]# vi /etc/yum.repos.d/rpmforge.repoenabled = 1enabled = 0
[root@host1 ~]# wget http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt
[root@host1 ~]# rpm --import RPM-GPG-KEY.dag.txt
確認(rèn)[root@host1 ~]# yum --enablerepo=rpmforge list

開(kāi)始安裝
[root@host1 ~]# yum --enable=rpmforge install lighttpd
[root@host1 ~]# yum --enable=rpmforge install lighttpd-fastcgi一般系統(tǒng)已經(jīng)有CentOS5.2 Apache下服務(wù)了,為了避免沖突,還要配置一下lighttpd,
[root@host1 ~]# vi /etc/lighttpd/lighttpd.conf#"mod_rewrite",#"mod_redirect",#"mod_alias","mod_rewrite","mod_redirect","mod_alias","mod_fastcgi","mod_fastcgi",
#server.port= 81server.port= 3000  ←端口設(shè)置成3000不要與CentOS5.2 Apache下的重復(fù)#server.bind= "127.0.0.1"server.bind= "localhost" 自啟動(dòng)[root@host1 ~]# chkconfig lighttpd on

Rails應(yīng)用程序的基本設(shè)置
[root@host1 ~]# cd /srv/www/lighttpd
[root@lighttpd]# mkdir rails
[root@lighttpd]# rails ./rails

賦予lighttpd用戶的權(quán)限
[root@host1 ~]# cd
[root@host1 ~]# chown -R lighttpd. /srv/www/lighttpd/rails
[root@host1 ~]# chmod +x /srv/www/lighttpd/rails/public/dispatch.*

CentOS5.2 Apache下的設(shè)
[root@host1 ~]# vi /etc/lighttpd/lighttpd.conf
加在末尾$HTTP["host"] =~ "ithurricane.dip.jp" {server.document-root = "/srv/www/lighttpd/rails/public"alias.url = ( "/" => "/srv/www/lighttpd/rails/public/" )server.indexfiles = ( "index.html", "dispatch.fcgi" )accesslog.filename = "/var/log/lighttpd/access.log"server.errorlog = "/var/log/lighttpd/server.log"server.error-handler-404 = "/dispatch.fcgi"
url.rewrite = ( "^/$" => "index.html", "^([^.]+)$" => "$1.html" )

fastcgi.server = (".fcgi" => ("localhost" => ("socket" => "/tmp/rails.fcgi.socket","bin-path" => "/srv/www/lighttpd/rails/public/dispatch.fcgi","bin-environment" => ("RAILS_ENV" => "production","RAILS_ROOT" => "/srv/www/lighttpd/rails"),"idol-timeout" => 10,"check-local" => "disable","min-procs" => 1,"max_procs" => 20)))}[root@host1 ~]# /etc/init.d/lighttpd start下面還要設(shè)置一下CentOS5.2 Apache下把對(duì)Rails的請(qǐng)求轉(zhuǎn)發(fā)到lighttpd[root@host1 ~]# vi /etc/httpd/conf.d/virtualhost.conf
ServerName ithurricane.dip.jp
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://127.0.0.1:3000/
大功告成,重載一下設(shè)定即可root@host1 ~]# /etc/init.d/httpd reload***導(dǎo)入圖像處理庫(kù),和數(shù)據(jù)庫(kù)SQLite3,這些都比較簡(jiǎn)單,一筆帶過(guò)了,
[root@host1 ~]# yum install freetype
[root@host1 ~]# yum install libpng
[root@host1 ~]# yum install gd-devel
[root@host1 ~]# gem install ruby-gd -- --build-flag --with-freetype
[root@host1 ~]# gem install sqlite3-rubySelect which gem to install for your platform (i686-linux)
1. sqlite3-ruby 1.2.1 (ruby)
2. sqlite3-ruby 1.2.1 (mswin32)
3. sqlite3-ruby 1.2.0 (mswin32)
4. sqlite3-ruby 1.2.0 (ruby)
5. Skip this gem
6. Cancel installation> 1終于完成了,把rails的服務(wù)打開(kāi)來(lái),看看成果吧,注意跑的是CentOS5.2 Apache下的80端口

到此,關(guān)于“CentOS5.2 Apache怎么搭建系統(tǒng)開(kāi)發(fā)環(huán)境”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注億速云網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI