欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Ubuntu+Nginx+Mysql+Php+Zend+eaccelerator安裝配置文字版

 更新時(shí)間:2012年02月13日 15:24:24   作者:  
把我架設(shè)lnmp網(wǎng)站的過(guò)程寫出來(lái),希望對(duì)想架設(shè)網(wǎng)站的朋友有所幫助,如有更好的辦法請(qǐng)?zhí)岢鰜?lái)
把我架設(shè)lnmp網(wǎng)站的過(guò)程寫出來(lái),希望對(duì)想架設(shè)網(wǎng)站的朋友有所幫助,如有更好的辦法請(qǐng)?zhí)岢鰜?lái)。
之所以用nginx沒(méi)用apache,是因?yàn)閚ginx的效率更高一些,尤其是對(duì)一些低配置的服務(wù)器,比如我在單位256M內(nèi)存的舊機(jī)器上架設(shè)的服務(wù)器。
1、安裝ubuntu server 10.04或10.10,其中安裝語(yǔ)言選的en,時(shí)區(qū)shanghai,服務(wù)只安裝ssh,其他全部用默認(rèn)就行。
提示:以上安裝過(guò)程完成后,建議用其他計(jì)算機(jī)登錄服務(wù)器,windows系統(tǒng)可以用putty,linux系統(tǒng)直接在終端用命令就可以:

代碼:
ssh 登錄名@服務(wù)器ip

因?yàn)橐韵逻^(guò)程得輸入大量命令和代碼,在客戶機(jī)上直接粘貼即可(在windows下的putty中單擊右鍵即可把剪貼板中的內(nèi)容粘貼到終端)。
2、添加源:

代碼:
復(fù)制代碼 代碼如下:

sudo vi /etc/apt/sources.list

lucid(10.04)的源添加如下:
代碼:
復(fù)制代碼 代碼如下:

deb http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
deb http://ppa.launchpad.net/nginx/stable/ubuntu lucid main
deb http://ppa.launchpad.net/brianmercer/php/ubuntu lucid main

maverick(10.10)的源:

代碼:
復(fù)制代碼 代碼如下:

deb http://archive.ubuntu.com/ubuntu/ maverick main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ maverick-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ maverick-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ maverick-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ maverick main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ maverick-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ maverick-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ maverick-backports main restricted universe multiverse
deb http://ppa.launchpad.net/nginx/stable/ubuntu maverick main

最后一行為nginx的ppa源,需要添加key,在終端運(yùn)行:

代碼:
復(fù)制代碼 代碼如下:

sudo apt-key adv --keyserver keyserver.Ubuntu.com --recv-keys C300EE8C

3、更新

代碼:
復(fù)制代碼 代碼如下:

sudo apt-get update

4、安裝網(wǎng)站系統(tǒng)

代碼:
復(fù)制代碼 代碼如下:

sudo apt-get install nginx php5-common php5-dev php5-cgi php5-fpm php-apc php5-mysql php5-curl php5-gd php5-idn php-pear php5-mcrypt php5-memcache php5-ming php5-recode php5-tidy php5-xmlrpc php5-xsl mysql-server

上面為必選安裝,以下php組件為可選安裝,一般網(wǎng)站程序可能用不著:

代碼:
復(fù)制代碼 代碼如下:

sudo apt-get install php5-imagick php5-imap php5-recode php5-snmp php5-sqlite php5-xmlrpc php5-suhosin php5-odbc php5-ladp

5、修改nginx配置文件

代碼:
復(fù)制代碼 代碼如下:

sudo vi /etc/nginx/sites-enabled/default

把其中的:

代碼:
復(fù)制代碼 代碼如下:

location / {
root /var/www;
index index.html index.htm;
}

改為:

代碼:
復(fù)制代碼 代碼如下:

location / {
root /var/www/nginx-default;
index index.php index.html index.htm;
}

其中的:

代碼:
#location ~ \.php$ {
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# include fastcgi_params;
#}

改為:

代碼:
復(fù)制代碼 代碼如下:

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /var/www/nginx-default$fastcgi_script_name;
include fastcgi_params;
}

6、更改網(wǎng)站目錄權(quán)屬:

代碼:
sudo chown -R ubuntu nginx-default/

注:其中的ubuntu為系統(tǒng)登錄用戶名。
7、安裝ZendGuardLoader及eaccelerator:

代碼:
復(fù)制代碼 代碼如下:

sudo mkdir /usr/zend
mkdir /tmp/eaccelerator
chmod 0777 /tmp/eaccelerator
wget http://phpcj.googlecode.com/files/ZendGuardLoader.so
sudo mv ZendGuardLoader.so /usr/zend/ZendGuardLoader.so
wget http://bart.eaccelerator.net/source/0.9.6.1/eaccelerator-0.9.6.1.tar.bz2
tar xvjf eaccelerator-0.9.6.1.tar.bz2
cd eaccelerator-0.9.6.1
cp control.php /var/www/nginx-default/control.php //復(fù)制控制程序到網(wǎng)站目錄,通過(guò)http://網(wǎng)站名/control.php訪問(wèn),默認(rèn)帳號(hào)為admin,密碼為eAccelertor,可編輯此文件修改。
phpize
sudo ./configure --enable-eaccelerator=shared
sudo make
sudo make install
sudo vi /etc/php5/fpm/php.ini

在配置文件最后加上:

代碼:
復(fù)制代碼 代碼如下:

zend_extension=/usr/zend/ZendGuardLoader.so
zend_loader.enable=1
zend_loader.disable_licensing=0
zend_loader.obfuscation_level_support=3
zend_loader.license_path=
zend_extension="/usr/lib/php5/20090626+lfs/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
eaccelerator.allowed_admin_path="/var/www/nginx-default/control.php"

8、(可選步驟)安裝phpmyadmin:

代碼:
復(fù)制代碼 代碼如下:

wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.3.9/phpMyAdmin-3.3.9-all-languages.tar.bz2
tar xvjf phpMyAdmin-3.3.9-all-languages.tar.bz2
mv phpMyAdmin-3.3.9-all-languages /var/www/nginx-default/phpmyadmin
cd /var/www/nginx-default/phpmyadmin
cp config.sample.inc.php config.inc.php
vi config.inc.php

將其中的:

代碼:
復(fù)制代碼 代碼如下:

$cfg['blowfish_secret'] = '';

改為:

代碼:
復(fù)制代碼 代碼如下:

$cfg['blowfish_secret'] = 'web';

下面的:

代碼:
復(fù)制代碼 代碼如下:

// $cfg['Servers'][$i]['controluser'] = 'pma';
// $cfg['Servers'][$i]['controlpass'] = 'pmapass';
// $cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
// $cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
// $cfg['Servers'][$i]['relation'] = 'pma_relation';
// $cfg['Servers'][$i]['table_info'] = 'pma_table_info';
// $cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
// $cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
// $cfg['Servers'][$i]['column_info'] = 'pma_column_info';
// $cfg['Servers'][$i]['history'] = 'pma_history';
// $cfg['Servers'][$i]['tracking'] = 'pma_tracking';
// $cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';

將//全部刪除,然后將其中的:

代碼:
復(fù)制代碼 代碼如下:

$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'pmapass';

pma和pmapass改為你的mysql用戶名和密碼,最后登錄phpmyadmin,將phpmyadmin/scripts目錄中的creat_tables.sql文件導(dǎo)入mysql。
9、重啟系統(tǒng)、上傳文件,網(wǎng)站建立成功!試試吧!
文件上傳建議用filezilla(http://filezilla-project.org/),免費(fèi)的開源ftp軟件,windows和linux都可以用,支持ssh的22端口。

附:系統(tǒng)及部分軟件管理操作
1、操作系統(tǒng):

代碼:
復(fù)制代碼 代碼如下:

sudo reboot now //重啟系統(tǒng)
sudo halt //關(guān)閉系統(tǒng)

2、nginx配置修改及生效:

代碼:
復(fù)制代碼 代碼如下:

sudo vi /etc/nginx/nginx.conf //修改配置
sudo vi /etc/nginx/sites-enabled/default //修改配置
sudo service nginx restart //重啟nginx

3、php配置修改及生效:

代碼:
復(fù)制代碼 代碼如下:

sudo vi /etc/php5/fpm/php.ini //修改配置
sudo service php5-fpm restart //重啟fastcgi進(jìn)程

3、網(wǎng)站目錄:

代碼:
復(fù)制代碼 代碼如下:

/var/www/nginx-default

4、eaccelerator管理:

代碼:
復(fù)制代碼 代碼如下:

http://你的網(wǎng)站/control.php

5、修復(fù)nginx+php出現(xiàn)的重大漏洞、修改上傳文件大?。梢钥茨阕约旱那闆r)

代碼:
復(fù)制代碼 代碼如下:

sudo vi /etc/php5/fpm/php.ini
cgi.fix_pathinfo = 0 //修復(fù)漏洞
upload_max_filesize = 2M改為5M //修改上傳文件大小

6、設(shè)定防火墻

代碼:
復(fù)制代碼 代碼如下:

sudo ufw enable
sudo ufw default deny
sudo ufw allow 80
sudo ufw allow 22

7、啟動(dòng)php5-fpm時(shí),出現(xiàn):

代碼:
復(fù)制代碼 代碼如下:

PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/fpm/conf.d/ming.ini on line 1 in Unknown on line 0
[WARNING] [pool www] pm.start_servers is not set. It's been set to 20.

的提示,第一行的原因是在配置文件中已用;代替#來(lái)進(jìn)行注釋。修改以下文件:

代碼:
復(fù)制代碼 代碼如下:

vi /etc/php5/fpm/conf.d/ming.ini

將#改為;即可。
第二行原因是/etc/php5/fpm/pool.d/www.conf配置文件中的

代碼:
;pm.start_servers = 20

去掉前面的;即可。
8、Discuz后臺(tái)啟動(dòng) URL靜態(tài)化,會(huì)提示 404 Not Found的解決辦法:
在niginx中開啟Rewrite,在服務(wù)器配置文件nignx.conf中寫入以下內(nèi)容,然后重啟nginx。


代碼:
復(fù)制代碼 代碼如下:

rewrite ^/archiver/((fid|tid)-[w-]+.html)$ /archiver/index.php?$1 last;
rewrite ^/forum-([0-9]+)-([0-9]+).html$ /forumdisplay.php?fid=$1&page=$2 last;
rewrite ^/thread-([0-9]+)-([0-9]+)-([0-9]+).html$ /viewthread.php?tid=$1&extra=page%3D$3&page=$2 last;
rewrite ^/space-(username|uid)-(.+).html$ /space.php?$1=$2 last;
rewrite ^/tag-(.+).html$ /tag.php?name=$1 last;
break;

以下內(nèi)容來(lái)自:http://www.vpsee.com/2011/04/some-nginx-rewrite-examples-for-subdirectories/,未測(cè)試。
Discuz! 7.2 安裝在子目錄 /bbs 下:

代碼:
復(fù)制代碼 代碼如下:

rewrite ^/bbs/archiver/((fid|tid)-[\w\-]+\.html)$ /bbs/archiver/index.php?$1 last;
rewrite ^/bbs/forum-([0-9]+)-([0-9]+)\.html$ /bbs/forumdisplay.php?fid=$1&page=$2 last;
rewrite ^/bbs/thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ /bbs/viewthread.php?tid=$1&extra=page%3D$3&page=$2 last;
rewrite ^/bbs/space-(username|uid)-(.+)\.html$ /bbs/space.php?$1=$2 last;
rewrite ^/bbs/tag-(.+)\.html$ /bbs/tag.php?name=$1 last;

Discuz! X1.5 安裝在子目錄 /bbs 下:

代碼:
復(fù)制代碼 代碼如下:

rewrite ^([^\.]*)/topic-(.+)\.html$ $1/portal.php?mod=topic&topic=$2 last;
rewrite ^([^\.]*)/article-([0-9]+)-([0-9]+)\.html$ $1/portal.php?mod=view&aid=$2&page=$3 last;
rewrite ^([^\.]*)/forum-(\w+)-([0-9]+)\.html$ $1/forum.php?mod=forumdisplay&fid=$2&page=$3 last;
rewrite ^([^\.]*)/thread-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=viewthread&tid=$2&extra=page%3D$4&page=$3 last;
rewrite ^([^\.]*)/group-([0-9]+)-([0-9]+)\.html$ $1/forum.php?mod=group&fid=$2&page=$3 last;
rewrite ^([^\.]*)/space-(username|uid)-(.+)\.html$ $1/home.php?mod=space&$2=$3 last;
rewrite ^([^\.]*)/([a-z]+)-(.+)\.html$ $1/$2.php?rewrite=$3 last;
if (!-e $request_filename) {
return 404;
}

相關(guān)文章

  • Nginx實(shí)現(xiàn)負(fù)載均衡的項(xiàng)目實(shí)踐

    Nginx實(shí)現(xiàn)負(fù)載均衡的項(xiàng)目實(shí)踐

    在我們實(shí)際生產(chǎn)中,一臺(tái)服務(wù)器的處理能力、存儲(chǔ)空間是有限的,這時(shí)候就需要負(fù)載均衡,本文詳細(xì)的介紹了Nginx實(shí)現(xiàn)負(fù)載均衡的項(xiàng)目實(shí)踐,具有一定的參考價(jià)值,感興趣的可以了解一下
    2022-03-03
  • 教你如何快速在CentOS7中安裝Nginx

    教你如何快速在CentOS7中安裝Nginx

    今天我們就只圖快不圖細(xì)的講解一下如何在CentOS7系統(tǒng)下快速安裝Nginx,本文通過(guò)圖文并茂的形式給大家展示,感興趣的朋友一起看看吧
    2021-09-09
  • nginx 代理80端口轉(zhuǎn)443端口的實(shí)現(xiàn)

    nginx 代理80端口轉(zhuǎn)443端口的實(shí)現(xiàn)

    這篇文章主要介紹了nginx 代理80端口轉(zhuǎn)443端口的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-09-09
  • nginx部署多前端項(xiàng)目的幾種方法

    nginx部署多前端項(xiàng)目的幾種方法

    最近一臺(tái)服務(wù)器要配置多個(gè)前端項(xiàng)目,個(gè)人總結(jié)了3種方法來(lái)實(shí)現(xiàn)在一臺(tái)服務(wù)器上使用nginx部署多個(gè)前端項(xiàng)目的方法。需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2021-05-05
  • Nginx實(shí)現(xiàn)https網(wǎng)站配置代碼實(shí)例

    Nginx實(shí)現(xiàn)https網(wǎng)站配置代碼實(shí)例

    這篇文章主要介紹了Nginx實(shí)現(xiàn)https網(wǎng)站配置代碼實(shí)例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-11-11
  • 分布式架構(gòu)中關(guān)于正向代理反向代理面試提問(wèn)

    分布式架構(gòu)中關(guān)于正向代理反向代理面試提問(wèn)

    這篇文章主要為大家介紹了分布式架構(gòu)中關(guān)于正向代理反向代理的面試提問(wèn),有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步
    2022-03-03
  • Nginx 正向代理和反向代理的配置實(shí)現(xiàn)

    Nginx 正向代理和反向代理的配置實(shí)現(xiàn)

    Nginx通過(guò)優(yōu)秀的架構(gòu)設(shè)計(jì)和高效的算法實(shí)現(xiàn)了高性能和高可靠性,本文主要介紹了Nginx 正向代理和反向代理的配置實(shí)現(xiàn),具有一定的參考價(jià)值,感興趣的可以了解一下
    2023-06-06
  • 使用Nginx做WebSockets代理教程

    使用Nginx做WebSockets代理教程

    這篇文章主要介紹了使用Nginx做WebSockets代理教程,本文給出了代理配置,和一個(gè)完整的node.js實(shí)現(xiàn)的WebSockets實(shí)例,需要的朋友可以參考下
    2015-01-01
  • Rhit高效可視化Nginx日志查看工具

    Rhit高效可視化Nginx日志查看工具

    一個(gè)格式化 Nginx 日志,可快速閱讀、查看 Nginx 日志的工具。 可以每秒處理百萬(wàn)行日志數(shù)據(jù),感興趣的可以了解一下
    2021-10-10
  • Nginx之QPS限制模塊的具體使用

    Nginx之QPS限制模塊的具體使用

    本文主要介紹了Nginx之QPS限制模塊的具體使用,主要介紹Nginx QPS限制模塊的原理、安裝和使用方法,具有一定的參考價(jià)值,感興趣的可以了解一下
    2023-09-09

最新評(píng)論