日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

nginx搭建文件服务器脚本,nginx搭建web服务器,配置端口复用

發(fā)布時間:2024/10/14 编程问答 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 nginx搭建文件服务器脚本,nginx搭建web服务器,配置端口复用 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

1、文件安裝目錄說明Nginx安裝目錄為/usr/local/nginx

Nginx主配置文件目錄為/usr/local/nginx/conf/nginx.conf

https密鑰key存放目錄/usr/local/nginx/sslkey/vhost*

網(wǎng)站存放目錄/usr/local/nginx/WebServer

各網(wǎng)站主配置文件存放目錄/usr/local/nginx/WebServer/vhost*.conf

2、Nginx主配置文件worker_processes??1;

events?{

worker_connections??1024;

}

http?{

include???????mime.types;

default_type??application/octet-stream;

sendfile????????on;

keepalive_timeout??65;

#gzip??on;

server?{

listen???????80;?????????????????#業(yè)務監(jiān)聽端口

server_name??localhost;

#charset?koi8-r;

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

location?/?{

root???html;

index??index.html?index.htm;

}

}

include?/usr/local/nginx/WebServer/*.conf;?????????????????#外鏈加載的主Nginx的配置文件路徑,需要指向到各個網(wǎng)站的配置文件上去

}

3、各網(wǎng)站主配置文件的解釋server?{

listen???????80;

server_name??www.secddi.com;???????#此處為需要重寫的URL地址

rewrite?^(.*)?https://$server_name$1?permanent;

}?????????????????????????????????????#以上配置文件的意思為重寫服務器的http?80端口至https?443端口

server?{

listen?443;

server_name?www.secddi.com;????????#此處為https的URL地址

index?index.html;

root?/usr/local/nginx/WebServer/vhostA;????????#此處為web網(wǎng)站的訪問目錄,主頁路徑

ssl_certificate??????/usr/local/nginx/sslkey/vhostA/full_chain.pem;????????#此處為配置的https證書路徑

ssl_certificate_key??/usr/local/nginx/sslkey/vhostA/private.key;???????????#此處為配置的https證書路徑

ssl_session_cache????shared:SSL:1m;

ssl_session_timeout??5m;

server_tokens?off;

fastcgi_param???HTTPS???????????????on;

fastcgi_param???HTTP_SCHEME?????????https;

access_log?/usr/local/nginx/logs/httpsaccess.log;

}

4、配置nginx腳本#!/bin/bash

#description:?Ngnix?Service

#chkconfig:2345?88?77

#幫助函數(shù)

Usage?(){

echo?$"Usage:$0?{start|stop|restart}"

}

#啟動函數(shù)

start(){

pid_file="/usr/local/nginx/logs/nginx.pid"

if?[?-f?$pid_file?];then

echo?"Ngnix?Already?Running,?Do?Not?Run?Again.。"

exit?1

else

echo?"Ngnix?Service?Is?Start?Running..."

/usr/local/nginx/sbin/./nginx

/usr/local/nginx/sbin/./nginx?-s?reload

fi

}

#停止函數(shù)

stop(){

pid_file="/usr/local/nginx/logs/nginx.pid"

if?[?-f?$pid_file?];then

echo?"Ngnix?coming?to?stop?running"

/usr/local/nginx/sbin/./nginx?-s?stop

else

echo?"Ngnix?is?not?running..."

exit?1

fi

}

#選擇語句

case?$1?in

start?)

start

;;

stop?)

stop

;;

restart?)

stop

sleep?1

start

;;

*?)

Usage

;;

esac

5、將配置文件保存在/etc/init.d/nginx位置即可。之后即可通過下面的命令進行啟動服務。chmod?+777?/etc/init.d/nginx

/etc/init.d/nginx?stop/start/restart

標簽:web,配置文件,stop,復用,server,nginx,usr,local

來源: https://blog.51cto.com/eholog/2685046

總結(jié)

以上是生活随笔為你收集整理的nginx搭建文件服务器脚本,nginx搭建web服务器,配置端口复用的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。