Set up the configuration method of Nginx+Mono running asp.net environment on CentOS

  • 2020-05-24 06:44:34
  • OfStack

Installation steps:

1. Obtain open source related programs:

1. Use the yum command of CentOS Linux system to install and upgrade required libraries:


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, download the program source package:

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


mkdir -p /down
cd /down
wget http://nginx.org/download/nginx-1.1.11.tar.gz

Mono download: website: 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

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


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

2. Install and compile Nginx:

1. Install the pcre library required for the installation of Nginx:


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 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 the nginx 
/opt/nginx/sbin/nginx

Enter the access address http://192.168.1.1(according to the personal home address page) in the browser and you will normally see the default nginx page

3. Install and compile Mono

1. Install libgdiplus:


mkdir -p /down
cd /down
wget http://nginx.org/download/nginx-1.1.11.tar.gz
0

2. Install Mono:


mkdir -p /down
cd /down
wget http://nginx.org/download/nginx-1.1.11.tar.gz
1

If the es1064en-V version information is available, the installation is successful.

3. Install XSP:


mkdir -p /down
cd /down
wget http://nginx.org/download/nginx-1.1.11.tar.gz
2

4. Configuration 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 with the following two lines:


mkdir -p /down
cd /down
wget http://nginx.org/download/nginx-1.1.11.tar.gz
4

6. Start:

1. Restart nginx:


mkdir -p /down
cd /down
wget http://nginx.org/download/nginx-1.1.11.tar.gz
5

2. Start fastcgi_mono server


mkdir -p /down
cd /down
wget http://nginx.org/download/nginx-1.1.11.tar.gz
6

7. Test:

Create a new asp.net web project and upload it to /data0/web directory for test run.


Related articles: