nginx安装
1
| $ sudo apt install nginx
|
1
| systemctl enable nginx.service
|
1
| systemctl start/restart/stop/status nginx.service
|
下面的三种方法均可查看nginx
的版本
1 2 3
| $ nginx -v $ nginx -V $ curl -i localhost
|
1
| systemctl start nginx.service
|

出现上图字样表示nginx
正常运行
nginx代理FTP服务器
参照之前这篇文章:
ubuntu云服务器搭建FTP环境
1
| vim /etc/nginx/nginx.conf
|
在nginx.conf
的http
块中添加如下内容:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| server{ listen 8080; # 监听端口,一定要在防火墙开放该端口 server_name localhost; # 映射名称,ip访
location / { alias /home/ftp/lyj/; # FTP服务器文件夹 autoindex on; # 打开文件目录列表 index lyj; # 设置欢迎页 autoindex_exact_size on;# 显示文件大小,单位字节 autoindex_localtime on; # 显示时间 charset utf-8,gbk; # 设置编码格式防止中文乱码
} }
|
1
| systemctl restart nginx.service
|
- 浏览器访问
ip:8080
即可访问FTP
服务的文件夹
参考:
Nginx代理FTP服务器