Difference between revisions of "Apache"

From ElectroDragon Wiki
 
(No difference)

Latest revision as of 04:17, 6 February 2020

Docker

  • docker run -p 80:80 -d httpd
  • docker run -p 80:80 -v $PWD/www/:/usr/local/apache2/htdocs/ -v $PWD/conf/httpd.conf:/usr/local/apache2/conf/httpd.conf -v $PWD/logs/:/usr/local/apache2/logs/ -d httpd

命令说明:

  • -p 80:80 :将容器的80端口映射到主机的80端口
  • -v $PWD/www/:/usr/local/apache2/htdocs/ :将主机中当前目录下的www目录挂载到容器的/usr/local/apache2/htdocs/
  • -v $PWD/conf/httpd.conf:/usr/local/apache2/conf/httpd.conf :将主机中当前目录下的conf/httpd.conf文件挂载到容器的/usr/local/apache2/conf/httpd.conf
  • -v $PWD/logs/:/usr/local/apache2/logs/ :将主机中当前目录下的logs目录挂载到容器的/usr/local/apache2/logs/

查看容器启动情况

  • runoob@runoob:~/apache$ docker ps
  • CONTAINER ID IMAGE COMMAND ... PORTS NAMES
  • 79a97f2aac37 httpd "httpd-foreground" ... 0.0.0.0:80->80/tcp sharp_swanson

Uninstall

  • sudo service apache2 stop
  • sudo apt-get purge apache2 apache2-utils apache2.2-bin apache2-common
  • sudo apt-get purge apache2 apache2-utils apache2-bin apache2.2-common
  • apt-get remove apache2
  • sudo apt-get autoremove
  • sudo apt remove apache2.*
  • whereis apache2
  • sudo rm -rf /etc/apache2
  • check - which is apache2