Build Nginx + Mono on CentOS to run asp.net

Source: Internet
Author: User
Installation steps: 1. obtain open-source programs: 1. use the yum command provided by CentOS Linux to install and upgrade the required libraries: sudo-sLANGCyum-yinstallgccgcc-c ++ autoconflibw.libjpeg-devellibpnglibpng-develf...

 

Installation steps:

1. obtain open-source programs:

1. use the yum command provided by CentOS Linux to install and upgrade the required libraries:

Sudo-s

LANG = C

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

 

2. download the program source code package:

Nginx installation package: http://nginx.org/en/download.html

Mkdir-p/down

Cd/down

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

 

 

 

Mono Download: Official site: http://download.mono-project.com/sources/mono/ (please download the latest version)

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

Libgdiplus Download: http://download.mono-project.com/sources/libgdiplus/ (please download the latest version)

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

Xsp Download: http://download.mono-project.com/sources/xsp/ (please download the latest version)

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

Pcre download (pcre library required for Nginx): ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ (please download the latest version)

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

II. install and compile Nginx:

1. install the pcre library required for Nginx installation:

Cd/down

Tar zxvf pcre-8.21.tar.gz

Cd pcre-8.21/

./Configure

Make & make install

Cd ../

 

2. create www users and groups

/Usr/sbin/groupadd www

/Usr/sbin/useradd-g www

Mkdir-p/data0/web

Chmod + w/data0/web

Chown-R www: www/data0/web

 

3. install 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. open port 80:

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

Start nginx

/Opt/nginx/sbin/nginx

 

Enter the access address http: // 192.168.1.1 in the browser (based on the personal address page). the default nginx page is displayed normally.

 

III. install and compile Mono

1. install 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. install Mono:

Tar-jxvf mono-2.10.7.tar.bz2

Cd mono-2.10.7

./Configure -- prefix =/opt/mono

Make & make install // this process takes a long time

 

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

 

If mono-V has mono version information, the installation is successful.

3. install XSP:

Cd/down

Tar-jxvf xsp-2.10.2.tar.bz2

./Configure -- prefix =/opt/mono

Make & make install

 

 

4. Configure 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;

}

}

 

 

5. configure fastcgi_params and add the following two lines:

Vi/opt/nginx/conf/fastcgi_params

Fastcgi_param PATH_INFO "";

Fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;

 

 

6. start:

1. restart nginx:

/Opt/nginx/sbin/nginx-s reload

2. start the fastcgi_mono server

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

 

VII. test:

Create an asp.net web project and upload it to the/data0/web directory for testing.

From wandrew.900

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.