CentOS上搭建Nginx + Mono 運行 asp.net

來源:互聯網
上載者:User

 

安裝步驟:

一、擷取開源相關程式:

1、利用CentOS Linux系統內建的yum命令安裝、升級所需的程式庫:

sudo -s

LANG=C

yum -y install gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel bison pkgconfig glib2-devel gettext make

 

2、下載程式源碼包:

Nginx安裝包::http://nginx.org/en/download.html

mkdir -p /down

cd /down

wget http://nginx.org/download/nginx-1.1.11.tar.gz

 

 

 

Mono下載:官網:http://download.mono-project.com/sources/mono/(請下載最新版)

wget http://download.mono-project.com/sources/mono/mono-2.10.7.tar.bz2

libgdiplus下載:http://download.mono-project.com/sources/libgdiplus/(請下載最新版)

wget http://download.mono-project.com/sources/libgdiplus/libgdiplus-2.10.tar.bz2

 xsp下載:http://download.mono-project.com/sources/xsp/(請下載最新版)

wget http://download.mono-project.com/sources/xsp/xsp-2.10.2.tar.bz2

pcre下載(Nginx所需的pcre庫):ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/(請下最新版)

wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.21.tar.gz

二、安裝編譯Nginx:

1、安裝安裝Nginx所需的pcre庫:

cd /down

tar zxvf pcre-8.21.tar.gz

cd pcre-8.21/

./configure

make && make install

cd ../

 

2、建立www使用者和組

/usr/sbin/groupadd www

/usr/sbin/useradd -g www www

mkdir -p /data0/web

chmod +w /data0/web

chown -R www:www /data0/web

 

3、安裝Nginx

tar zxvf nginx-1.1.11.tar.gz

cd nginx-1.1.11/

./configure --user=www --group=www --prefix=/opt/nginx --with-http_stub_status_module --with-http_ssl_module

make && make install

cd ../

 

 

4、開放80連接埠:

iptables -I INPUT -p tcp --dport 80 -j ACCEPT

啟動nginx

/opt/nginx/sbin/nginx

 

在瀏覽器上輸入訪問地址http://192.168.1.1(根據個人本機地址頁定),正常會看到預設nginx頁面

 

三、安裝編譯Mono

1、安裝libgdiplus:

cd /down

 

tar -jxvf libgdiplus-2.10.tar.bz2

cd libgdiplus-2.10

./configure --prefix=/opt/mono

make && make install

echo "/opt/mono/lib" > /etc/ld.so.conf.d/mono.conf

ldconfig

 

2、安裝Mono:

tar –jxvf mono-2.10.7.tar.bz2

cd mono-2.10.7

./configure --prefix=/opt/mono

make && make install //此處時間較長

 

echo export PKG_CONFIG_PATH=/opt/mono/lib/pkgconfig:$PKG_CONFIG_PATH>>~/.bash_profile

echo export LD_LIBRARY_PATH=/opt/mono/lib:$LD_LIBRARY_PATH>>~/.bash_profile

echo export PATH=/opt/mono/bin:$PATH>>~/.bash_profile

source ~/.bash_profile

 

 輸入mono -V 如有mono版本資訊,則安裝成功.

3、安裝XSP:

cd /down

tar –jxvf xsp-2.10.2.tar.bz2

./configure --prefix=/opt/mono

make && make install

 

 

四、配置Nginx

vi /opt/nginx/conf/nginx.conf

server {

         listen   80;

         server_name  localhost;

         location / {

                 root /data0/web;

                 index index.html index.htm;

                 fastcgi_index Default.aspx;

                 fastcgi_pass 127.0.0.1:9000;

                 include fastcgi_params;

         }

 }

 

 

五、配置fastcgi_params增加下面兩行:

vi /opt/nginx/conf/fastcgi_params

fastcgi_param  PATH_INFO          "";

fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

 

 

六、啟動:

1、重啟nginx:

/opt/nginx/sbin/nginx -s reload

2、啟動fastcgi_mono伺服器

fastcgi-mono-server2 /applications=/:/data0/web /socket=tcp:127.0.0.1:9000 &

 

七、測試:

建立一個asp.net web項目上傳至/data0/web目錄下,測試回合。

  摘自 wander112900

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.