1:下载安装软
nginx的-1.8.0.tar.gz
PCRE-8.35.tar.gz
2:预先安装软件
error:configure: error: You need a C++ compiler for C++ support.
解决 输入命令:yum install -y gcc gcc-c ++.
error:./configure: error: SSL modules require the OpenSSL library.
解决:yum -y install openssl openssl-devel
error:./nginx: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
解决:32位系统 [root@sever lib]# ln -s /usr/local/lib/libpcre.so.1 /lib
解决:64位系统 [root@sever lib]# ln -s /usr/local/lib/libpcre.so.1 /lib6
3:预先安装软件
#tar zxvf pcre-8.10.tar.gz
#cd pcre-8.10/
#./configure && make && make install cd …/
4:预先安装软件
#tar zxvf nginx-0.8.46.tar.gz
#cd nginx-0.8.46/ ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
#make && make install cd …/
5:安装日志
427 ll
428 cd /
429 ll
430 cd root
431 ll
432 cd /soft
433 mkdir /soft
434 ll
435 cd /soft
436 ll
437 pwd
438 ll
439 tar zxvf nginx-1.8.0.tar.gz
440 tar zxvf pcre-8.35.tar.gz
441 ll
442 rm -rf *.gz
443 ll
444 cd pcre-8.35/
445 ll
446 ./configure && make && make install
447 yum list
448 yum install -y gcc gcc-c++
449 ./configure && make && make install
450 cd /var/cache/yum
451 ll
452 cd /soft/
453 ll
454 cd nginx-1.8.0/
455 ll
456 ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
457 make && make install
458 cat /user
459 cat /etc/passwd
460 cat /etc/group
461 groupadd -g 503 nginx
462 useradd -g nginx -d /home/nginx -s /bin/bash -m nginx -u 1005
463 ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
464 apt-get install openssl
465 apt -get install openssl
466 yum install openssl openssl-devel
468 ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
469 yum -y install openssl openssl-devel
470 ./configure --user=nginx --group=nginx --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
471 make && make install
472 cd /usr/local/nginx/
473 ll
474 cd sbin
475 ll
476 ./nginx
477 ln -s /usr/local/lib/libpcre.so.1 /lib64
478 ./nginx
479 ps -ef|grep nginx
480 mkdir -p /web/baidu /web/sina
481 cd /web
482 tree web
483 ll
484 cd …
485 tree web
486 ls
487 cd web
488 ll
489 cd baidu/
490 ll
491 vi index.html
492 cd …/sina/
493 vi index.html
494 ll
495 cd /
496 ll
497 cd /usr/local/nginx/
498 ll
499 cd conf/
500 ll
501 pwd
502 cp nginx.conf nginx.conf.20150911
503 vi nginx.conf
504 pkill nginx
505 pkill -HUP nginx
506 cd /web/baidu/
507 ll
508 chmod +x index.html
509 cd …/sina/
510 chmod +x index.html
511 ll
512 pkill nginx
513 pkill -HUP nginx
514 netstat -an | grep 80
515 netstat -an | grep :80
516 cd /usr/local/nginx/
517 ll
518 cd sbin/
519 ./nginx
520 netstat -an | grep :80
521 cd /web/baidu/
522 ll
523 vi index.html
524 cd /usr/local/nginx/
525 ll
526 cd logs/
527 ll
528 more error.log
529 more baidu.access.log
530 history
6:配置nginx配置文件
server {
listen 80;
server_name www.baidu.com;
access_log logs/baidu.access.log main;
location / {
root /web/baidu;
index index.html index.htm;
}
}
server {
listen 80;
server_name www.sina.com;
access_log logs/sina.access.log main;
location / {
root /web/sina;
index index.html index.htm;
}
}
7:配置本地DNS服务器
输入命令: drivers
输入命令:C:\Windows\System32\drivers\etc\hosts
192.168.1.124 www.baidu.com
192.168.1.124 www.sina.com