Sign inSign up

hengxi/static_web

By hengxi

Updated almost 10 years ago

使用ubuntu系统安装nginx后可以运行静态页面

Image
0

172

hengxi/static_web repository overview

docker run -p 80 --name static_web -i -t ubuntu /bin/bash apt-get update apt-get install -y nginx apt-get install -y vim #-p支持一次创建层次的多个文件夹,不用多次执行mkdir命令 mkdir -p /data/web vim test.html whereis nginx ls /etc/nginx/sites-enabled vim /etc/nginx/sites-enabled/default ( root /data/web; #listen [::]:80 default_server; ) nginx #查看docker容器的端口映射,看docker容器的80端口映射到了宿主机的那个端口上(需重命名容器为static_web) docker port static_web #查看docker中进程状态 docker top static_web

#启动docker容器后需要执行命令,用于启动nginx docker exec web nginx #需要注意每次重新启动该docker容器都会被分配全新的ip地址,及和主机的端口映射

Tag summary

Content type

Image

Digest

Size

179 MB

Last updated

almost 10 years ago

docker pull hengxi/static_web