Static WEB pages set up by nginx

Preface:

The last chapter say nginx configuration

This chapter nginx configuration WEB page within the network including local networks of
not doing mapping (because you want to spend money) it can not be accessed outside the network

I am ready to follow-up with a simple c ++ realize what the web page back-end database management company made some personnel of product information
Here Insert Picture Description

You can visit my website by ip company LAN

My linux virtual machine ip to use bridging mode Do not share this pit ahead of me give you step on the
otherwise others can not access your web page

Here Insert Picture Description
Now add a network card address is 192.168.31.88
add a 192.168.31.98 must be under administrator privileges

ifconfig eth0:0 192.168.31.98

Here Insert Picture Description

Then I created two web sites directory in my home directory

mkdir /home/shenmingyi/website1
mkdir /home/shenmingyi/website2

You can easily set the position but remember

Here Insert Picture Description

Creating a two html pages inside a place just within the site directory

echo "this is website1" >/website1/index.html
echo "this is website2" >/website2/index.html

Nginx conf to modify the configuration file
location in /usr/local/nginx/conf/nginx.conf

Simply look at the meaning of the parameter configuration file

worker_precesses 1
worker process: sum. The adjustment hardware, typically equal to or twice the number of CPU on the CPU.
I am here to open the virtual machine configuration is very low and so is 1

error_log error log is here the default comment

worker_connections 1024
the maximum number of connections and hardware work processes related to
my configuration is low and some people are 201400

keepalive timeout

A virtual machine configuration
Server {
the listen 80;
listening port number

server_name localhost
访问的域名 现在是本机

}

Here Insert Picture Description

This file would have a server we have to add a
Here Insert Picture Description
to according to your own ip

Note location position
Here Insert Picture Description
on these three places need to modify the note in brackets align
the listen
server_name
root at the location

In tinkering vi / etc / hosts
Here Insert Picture Description
to add both domain names can be used in the machine but can not access other computers can not add nothing with eggs

Then stop at nginx
./sbin/nginx -s STOP
restart
./sbin/nginx

If you open the browser is configured as follows on the success of theHere Insert Picture Description

Would later write the configuration database and implement the back-end with c ++

Published 171 original articles · won praise 386 · views 160 000 +

Guess you like

Origin blog.csdn.net/weixin_42837024/article/details/102919735