CentOS MONO nginx running

Yesterday I did a test of deploying .net On linux, and the debugging was successful today.

Deployment environment:

CentOS6.2 X86-64

libgdiplus-2.10

mono 2.10.8

xsp-2.10

nginx1.2.7

Step 1: Install the necessary software packages

yum install gcc gcc-c++ bison pkgconfig glib2-devel gettext make libpng-devel libjpeg-devel

libtiff-devel libexif-devel giflib-devel

libX11-devel freetype-devel fontconfig-devel cairo-devel

(If you need any dependencies during the compilation process, install it again, that's almost the same) There is also openssl-devel to install, because you need to install the pcre software (nginx needs it). If you are installing Linux minimally, then you have to install yum install wget unzip

Step 2: Prepare the corresponding software

Download libgdiplus-2.10

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

Download mono2.10.8

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

Download xsp-2.10

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

Download pcre

wget  ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.32.zip

Download Nginx

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

--------------------Cut it off---------------------------

The third step: installation

Install libgdiplus-2.10 first

tar jxvf  libgdiplus-2.10.tar.bz2

cd   libgdiplus-2.10

./configure --prefix=/opt/mono

make

make install

Install mono

tar -jxvf mono-2.10.8.tar.bz2

cd mono-2.10.8

./configure --prefix=/opt/mono

make (this step takes a long time)

make install

Change environment variables

Go back to the home directory of the installation user: cd ~

Edit the .bash_profile file in the home directory

vi  .bash_profile

Add at the end:

PKG_CONFIG_PATH=/opt/mono/lib/pkgconfig

LD_LIBRARY_PATH=/opt/mono/lib

PATH=/opt/mono/bin:$PATH

export PKG_CONFIG_PATH LD_LIBRARY_PATH PATH

Save and exit

vi /etc/ld.so.conf

Add /opt/mono/lib at the end

I am a little dizzy at the above step. This operation is to add the mono lib to the global lib, and the above environment variable LD_LIBRARY_PATH=/opt/mono/lib

For the same purpose, if you can't find it in ld.so.conf, just look for it in LD_LIBRARY_PATH=/opt/mono/lib. Is it a duplicate? ?

Leave these alone and continue.

After the operation, there are two ways to make the system parameters take effect:

First: ./.bash_profile (execute the sub-command at home directory)

ldconfig (execute sub-commands anywhere, purpose: load lib)

Second: logout log out the user, log in again

If your environment variables are generated, enter mono -V to view the mono version

If the version is displayed correctly, the installation is correct.

Install xsp-2.10

tar jxvf  xsp-2.10.tar.bz2

cd xsp-2.10

./configure -prefix=/opt/mono

make

make install

Install pcre

unzip  pcre-8.32.zip

cd  pcre-8.32

./configure --prefix=/usr/local/pcre

make

make install

It stands to reason that this is ok, but something went wrong. The problem is below...

Install nginx

tar zxvf nginx-1.2.7.tar.gz

cd  nginx-1.2.7

Create users and groups:

useradd www

./configure --prefix=/opt/nginx  --user=www --group=www --with-http_stup_status_module --with-http_ssl_module --with-pcre=../pcre-8.32

make

make install

The highlight is in the green part. The green parameter indicates the pcre decompression directory. What nginx wants is its decompression directory. Then why do I still compile and install pcre above?

I am afraid that there will be an error in this step. Try compiling and installing to see if it can pass. Sure enough, there is a lack of openssl support. yum install openssl-devel will do.

I deleted /usr/local/pcre. rm -rf /usr/local/pcre

Add nginx's sbin to the environment variable:

vi .bash_profile

Change PATH=/opt/mono/bin:PATH to PATH=/opt/nginx/sbin:/opt/mono/bin:PATH and it’s ok.

Part 4: Modify the configuration file

Modify /opt/nginx/conf/nginx.conf

server {
        listen       80;
        server_name  localhost;
        location / {
root  /data/web;
            index  index.html index.htm;
            #fastcgi_index Default.aspx;
fastcgi_pass  127.0.0.1:9000;
include   /opt/nginx/conf/fastcgi_params;
        }

error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
The red part is the modified place.

Modify /opt/nginx/conf/fastcgi_params

Add in the bottom line:

fastcgi_param  PATH_INFO          "";
       fastcgi_param  SCRIPT_FILENAME    document_rootfastcgi_script_name;

These two modifications are used to make nginx support .net MVC

Okay, save and exit.

I customized the parameters above to create the folder /data/web. If I am used to it, change the directory to /var/www/html. Ha ha.

Start nginx

/opt/nginx/sbin/nginx

If the nginx environment variable modified above takes effect, directly enter nginx to start.

Then start fastcgi

fastcgi-mono-server2 /applications=www.domain1.xyz:/:/var/www/www.domain1.xyz/ /socket=tcp:127.0.0.1:9000

Does the above startup go to the background? If you need to run in the background, add a &

Step 5: Test

cd /data/web

vim test.aspx

Input content: <%="HelloWorld!"%>Save and exit.

Type in the browser: ip/test.aspx to see if it runs?

nginx restart: nginx -s reload

nginx is off: ps -ef |grep nginx

kill -9 nginx process

Fastcgi is closed as above.

Recommended Posts

CentOS MONO nginx running
Centos7.3 install nginx
Centos7 install Nginx
CentOs7.3 compile and install Nginx 1.9.9
CentOS 7 install Mono and MonoDevelop
Tencent Cloud Centos install nginx
Install Nginx server on CentOS 7
Use Nginx and u under CentOS
CentOS 8 (2)
CentOS 7 install Nginx, PHP, MySQL packages
CentOS 6.x compile and install Nginx
How to install Nginx on CentOS 8
CentOS7.2 and Nginx configuration virtual host
CentOS 8 (1)
Build Nginx environment on Linux (CentOS)
(centos7) linux build nginx load balancing build
Centos install php73 fast cgi + nginx
Install Mono 3.2 and Jexus 5.4 under CentOS 6.3
Configure Nginx reverse proxy based on CentOS 7
Configure Nginx load balancing based on CentOS 7
Configure Nginx forward proxy based on CentOS 7
Centos7 deploys HAproxy to implement Nginx cluster
Deploy Docker and configure Nginx in CentOS
Install Mono 2.10.8 and Jexus 5.0 under 32- and 64-bit CentOS 6.0