国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
centOS7安裝nginx及nginx配置

安裝所需插件

1、安裝gcc

gcc是linux下的編譯器在此不多做解釋,感興趣的小伙伴可以去查一下相關資料,它可以編譯 C,C++,Ada,Object C和Java等語言

命令:查看gcc版本 

gcc -v

 

一般阿里云的centOS7里面是都有的,沒有安裝的話會提示命令找不到,

安裝命令:

yum -y install gcc

 

2、pcre、pcre-devel安裝

pcre是一個perl庫,包括perl兼容的正則表達式庫,nginx的http模塊使用pcre來解析正則表達式,所以需要安裝pcre庫。

安裝命令:

yum install -y pcre pcre-devel

 

3、zlib安裝

zlib庫提供了很多種壓縮和解壓縮方式nginx使用zlib對http包的內容進行gzip,所以需要安裝

安裝命令:

yum install -y zlib zlib-devel

 

4、安裝openssl

openssl是web安全通信的基石,沒有openssl,可以說我們的信息都是在裸奔。。。。。。

安裝命令:

yum install -y openssl openssl-devel

 

安裝nginx

1、下載nginx安裝包

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

 

2、把壓縮包解壓到usr/local/java

tar -zxvf  nginx-1.9.9.tar.gz

 

3、切換到cd /usr/local/java/nginx-1.9.9/下面

執(zhí)行三個命令:

  1. ./configure

  2. make

  3. make install

 

5、切換到/usr/local/nginx安裝目錄

6、配置nginx的配置文件nginx.conf文件,主要也就是端口

可以按照自己服務器的端口使用情況來進行配置

ESC鍵,wq!強制保存并退出

7、啟動nginx服務

切換目錄到/usr/local/nginx/sbin下面

啟動nginx命令:

./nginx

 

8、查看nginx服務是否啟動成功

ps -ef | grep nginx

 

9、訪問你的服務器IP

顯示

說明安裝和配置都沒問題OK了

nginx.conf說明

  1. #user nobody;
  2. worker_processes 1; #工作進程:數(shù)目。根據(jù)硬件調整,通常等于cpu數(shù)量或者2倍cpu數(shù)量。

  3. #錯誤日志存放路徑
  4. #error_log logs/error.log;
  5. #error_log logs/error.log notice;
  6. #error_log logs/error.log info;

  7. #pid logs/nginx.pid; # nginx進程pid存放路徑


  8. events {
  9. worker_connections 1024; # 工作進程的最大連接數(shù)量
  10. }


  11. http {
  12. include mime.types; #指定mime類型,由mime.type來定義
  13. default_type application/octet-stream;

  14. # 日志格式設置
  15. #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
  16. # '$status $body_bytes_sent "$http_referer" '
  17. # '"$http_user_agent" "$http_x_forwarded_for"';

  18. #access_log logs/access.log main; #用log_format指令設置日志格式后,需要用access_log來指定日志文件存放路徑

  19. sendfile on; #指定nginx是否調用sendfile函數(shù)來輸出文件,對于普通應用,必須設置on。
  20. 如果用來進行下載等應用磁盤io重負載應用,可設著off,以平衡磁盤與網(wǎng)絡io處理速度,降低系統(tǒng)uptime。
  21. #tcp_nopush on; #此選項允許或禁止使用socket的TCP_CORK的選項,此選項僅在sendfile的時候使用

  22. #keepalive_timeout 0; #keepalive超時時間
  23. keepalive_timeout 65;

  24. #gzip on; #開啟gzip壓縮服務

  25. #虛擬主機
  26. server {
  27. listen 80; #配置監(jiān)聽端口號
  28. server_name localhost; #配置訪問域名,域名可以有多個,用空格隔開

  29. #charset koi8-r; #字符集設置

  30. #access_log logs/host.access.log main;

  31. location / {
  32. root html;
  33. index index.html index.htm;
  34. }
  35. #錯誤跳轉頁
  36. #error_page 404 /404.html;

  37. # redirect server error pages to the static page /50x.html
  38. #
  39. error_page 500 502 503 504 /50x.html;
  40. location = /50x.html {
  41. root html;
  42. }

  43. # proxy the PHP scripts to Apache listening on 127.0.0.1:80
  44. #
  45. #location ~ \.php$ {
  46. # proxy_pass http://127.0.0.1;
  47. #}

  48. # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
  49. #
  50. #location ~ \.php$ { #請求的url過濾,正則匹配,~為區(qū)分大小寫,~*為不區(qū)分大小寫。
  51. # root html; #根目錄
  52. # fastcgi_pass 127.0.0.1:9000; #請求轉向定義的服務器列表
  53. # fastcgi_index index.php; # 如果請求的Fastcgi_index URI是以 / 結束的, 該指令設置的文件會被附加到URI的后面并保存在變量$fastcig_script_name中
  54. # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
  55. # include fastcgi_params;
  56. #}

  57. # deny access to .htaccess files, if Apache's document root
  58. # concurs with nginx's one
  59. #
  60. #location ~ /\.ht {
  61. # deny all;
  62. #}
  63. }


  64. # another virtual host using mix of IP-, name-, and port-based configuration
  65. #
  66. #server {
  67. # listen 8000;
  68. # listen somename:8080;
  69. # server_name somename alias another.alias;

  70. # location / {
  71. # root html;
  72. # index index.html index.htm;
  73. # }
  74. #}


  75. # HTTPS server
  76. #
  77. #server {
  78. # listen 443 ssl; #監(jiān)聽端口
  79. # server_name localhost; #域名

  80. # ssl_certificate cert.pem; #證書位置
  81. # ssl_certificate_key cert.key; #私鑰位置

  82. # ssl_session_cache shared:SSL:1m;
  83. # ssl_session_timeout 5m;

  84. # ssl_ciphers HIGH:!aNULL:!MD5; #密碼加密方式
  85. # ssl_prefer_server_ciphers on; # ssl_prefer_server_ciphers on; #


  86. # location / {
  87. # root html;
  88. # index index.html index.htm;
  89. # }
  90. #}

  91. }

 

 

本站僅提供存儲服務,所有內容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權內容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
CentOS7.0安裝Nginx 1.7.4
Linux學習9-CentOS搭建nginx環(huán)境
運維知識:CentOS7使用源碼編譯安裝Nginx
Centos下 Nginx安裝與配置
Nginx參考
CentOS7離線安裝Nginx,包含gcc、g++環(huán)境
更多類似文章 >>
生活服務
分享 收藏 導長圖 關注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服