欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

nginx搭建文件服務(wù)器的詳細(xì)過程

 更新時(shí)間:2023年06月15日 10:33:55   作者:datadev_sh  
這篇文章主要介紹了nginx搭建文件服務(wù)器,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

安裝nginx

yum -y install nginx

搭建文件服務(wù)器

1.改為root用戶

原來的nginx.conf里,第一行是

user ngix;  # 不同版本的不一樣

改為

user root;

2.加一個(gè)server

①配置文件位置

[root@VM_0_9_centos ~]# find / -name nginx.conf
/var/opt/gitlab/nginx/conf/nginx.conf
/opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/unicorn-5.1.0/examples/nginx.conf
/opt/gitlab/embedded/conf/nginx.conf  
/etc/nginx/nginx.conf  # 這個(gè)是要找的文件

②html目錄

/usr/share/nginx/html  # 默認(rèn)的

③在原來的nginx.conf里加一個(gè)server配置

配置寫在http { } 里面,與其他server 同級(jí)別。

autoindex on;# 顯示目錄
	autoindex_exact_size on;# 顯示文件大小
	autoindex_localtime on;# 顯示文件時(shí)間
	server {
		listen       8080 default_server;
		listen       [::]:8080 default_server;
		server_name  _;
		#root         /usr/share/nginx/html;
		root         /data/;
		location / {
		}
		error_page 404 /404.html;
			location = /40x.html {
		}
		error_page 500 502 503 504 /50x.html;
			location = /50x.html {
		}
	}

參考:http://www.dbjr.com.cn/article/247578.htm

3.啟動(dòng)

service nginx start
service nginx stop 
service nginx restart   # 重啟
nginx -s reload   # 修改配置后重啟,或者使用reload重載配置文件

4.訪問界面

5.完整的nginx配置參考

user root;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;
events {
    worker_connections 1024;
}
http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;
    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;
    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;
    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html;
        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;
        include /etc/nginx/conf.d/*.conf;
        location / {
        }
        error_page 404 /404.html;
            location = /40x.html {
        }
        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
	autoindex on;# 顯示目錄
	autoindex_exact_size on;# 顯示文件大小
	autoindex_localtime on;# 顯示文件時(shí)間
	server {
		listen       6868 default_server;
		listen       [::]:6868 default_server;
		server_name  _;
		#root         /usr/share/nginx/html;
		root         /;
		location / {
		}
		error_page 404 /404.html;
			location = /40x.html {
		}
		error_page 500 502 503 504 /50x.html;
			location = /50x.html {
		}
	}
}

到此這篇關(guān)于nginx搭建文件服務(wù)器的文章就介紹到這了,更多相關(guān)nginx文件服務(wù)器內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Nginx實(shí)現(xiàn)非套路鏡像站的踩坑記錄

    Nginx實(shí)現(xiàn)非套路鏡像站的踩坑記錄

    這篇文章主要給大家介紹了關(guān)于Nginx實(shí)現(xiàn)非套路鏡像站的踩坑記錄,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧。
    2018-02-02
  • Nginx rewrite地址重寫的詳細(xì)解析

    Nginx rewrite地址重寫的詳細(xì)解析

    在Nginx中使用重寫可以通過配置rewrite指令來實(shí)現(xiàn),本文主要介紹了Nginx rewrite地址重寫的詳細(xì)解析,具有一定的參考價(jià)值,感興趣的可以了解一下
    2024-07-07
  • Nginx could not build the server_names_hash 錯(cuò)誤的解決辦法

    Nginx could not build the server_names_hash 錯(cuò)誤的解決辦法

    這篇文章主要介紹了Nginx could not build the server_names_hash 錯(cuò)誤的解決辦法,需要的朋友可以參考下
    2014-03-03
  • nginx實(shí)現(xiàn)請(qǐng)求轉(zhuǎn)發(fā)

    nginx實(shí)現(xiàn)請(qǐng)求轉(zhuǎn)發(fā)

    本文給大家分享的是使用nginx實(shí)現(xiàn)代理(請(qǐng)求轉(zhuǎn)發(fā))的教程及簡單示例,非常實(shí)用,有需要的小伙伴可以參考下
    2017-07-07
  • Keepalived+Nginx+Tomcat 實(shí)現(xiàn)高可用Web集群的示例代碼

    Keepalived+Nginx+Tomcat 實(shí)現(xiàn)高可用Web集群的示例代碼

    這篇文章主要介紹了Keepalived+Nginx+Tomcat 實(shí)現(xiàn)高可用Web集群的示例代碼,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-09-09
  • Mac使用Nginx設(shè)置代理并禁用自帶Apache的問題記錄

    Mac使用Nginx設(shè)置代理并禁用自帶Apache的問題記錄

    本文介紹如何在Mac上禁用自帶的Apache服務(wù)并安裝Nginx,首先需要關(guān)閉Apache并禁止其自啟動(dòng),接著,通過Homebrew安裝Nginx,并配置其文件和目錄,最后,介紹了如何生成SSL/自簽名證書,詳細(xì)步驟包括修改Apache配置、安裝Nginx、編輯Nginx配置文件以及驗(yàn)證和重啟Nginx服務(wù)
    2024-09-09
  • 解決nginx+lua搭建文件上傳下載服務(wù)問題

    解決nginx+lua搭建文件上傳下載服務(wù)問題

    這篇文章主要介紹了nginx+lua搭建文件上傳下載服務(wù),涉及到nginx安裝配置方法,本文通過代碼給大家介紹的非常詳細(xì),需要的朋友可以參考下
    2017-12-12
  • windows下RunHiddenConsole 啟動(dòng) nginx與php(RunHiddenConsole下載)

    windows下RunHiddenConsole 啟動(dòng) nginx與php(RunHiddenConsole下載)

    這篇文章主要介紹了RunHiddenConsole 啟動(dòng) nginx與php的相關(guān)資料,希望通過本文能幫助到大家,讓大家學(xué)會(huì)使用RunHiddenConsole,需要的朋友可以參考下
    2017-10-10
  • Nginx中sub_filter 配置使用小結(jié)

    Nginx中sub_filter 配置使用小結(jié)

    sub_filter?是一個(gè)用于替換響應(yīng)內(nèi)容的模塊,本文主要介紹了 Nginx中sub_filter 配置使用小結(jié),具有一定的參考價(jià)值,感興趣的可以了解一下
    2024-05-05
  • 解決使用了nginx獲取IP地址都是127.0.0.1 的問題

    解決使用了nginx獲取IP地址都是127.0.0.1 的問題

    這篇文章主要介紹了解決使用了nginx獲取IP地址都是127.0.0.1 的問題,獲取i工具的完整代碼文中給大家提到,具體實(shí)例代碼跟隨小編一起看看吧
    2021-09-09

最新評(píng)論