导出虚拟环境依赖及Apache配置

你在本地把所有依赖都弄到一个文件中 pip freeze > requirements.txt,把该文件上传到服务器。

然后再在服务器上先新建一个python虚拟环境,再激活虚拟环境,切换到requirements.txt文件夹目录下,

通过 pip install -r requirements.txt就会把所有依赖全部装上。

==================================================

    232 Listen 81
    233 <VirtualHost 172.17.87.198:81>
    234     ServerAdmin webmaster@dummy-host2.example.com
    235     DocumentRoot "/home/HT/yadong/"
    236     #ErrorLog "/home/HT/yadong/log"
    237     #CustomLog "logs/dummy-host2.example.com-access_log common"
    238 </VirtualHost>

 =================================================

首先安装apache:

sudo apt-get install apache2

安装完毕后,重启下服务:

/etc/init.d/apache2 restart

输入你的密码,屏幕显示如下字样表示重启完毕:

[....] Restarting apache2 (via systemctl): apache2.service

==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===

Authentication is required to restart ‘apache2.service‘.

Authenticating as: Wagner,,, (wagner)

Password: 

==== AUTHENTICATION COMPLETE ===

. ok

然后,使用浏览器输入127.0.0.1试一下能否进入apache的欢迎界面,如果进入,则表示apache安装成功。

 ==========================================================

ht@HT:/etc/apache2$ /etc/init.d/apache2 start
[....] Starting apache2 (via systemctl): apache2.serviceFailed to start apache2.service: Connection timed out
See system logs and 'systemctl status apache2.service' for details.
 failed!
ht@HT:/etc/apache2$ cat /var/log/messages | grep httpd
cat: /var/log/messages: No such file or directory
ht@HT:/etc/apache2$ systemctl --failed
  UNIT                         LOAD   ACTIVE SUB    DESCRIPTION
● systemd-modules-load.service loaded failed failed Load Kernel Modules
● ureadahead.service           loaded failed failed Read required files in advance

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

2 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

ht@HT:/etc/apache2$ systemctl status apache2.service
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: inactive (dead) since 日 2018-01-28 15:03:50 CST; 13min ago
     Docs: man:systemd-sysv-generator(8)

1月 28 15:03:50 HT apache2[4316]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]
1月 28 15:03:50 HT apache2[4316]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.
1月 28 15:03:50 HT apache2[4316]: no listening sockets available, shutting down
1月 28 15:03:50 HT apache2[4316]: AH00015: Unable to open logs
1月 28 15:03:50 HT apache2[4316]: Action 'start' failed.
1月 28 15:03:50 HT apache2[4316]: The Apache error log may have more information.
1月 28 15:03:50 HT apache2[4316]:  *
1月 28 15:03:50 HT apache2[4344]:  * Stopping Apache httpd web server apache2
1月 28 15:03:50 HT apache2[4344]:  *
1月 28 15:03:50 HT systemd[1]: Started LSB: Apache2 web server.

==============================>不能和boa服务器一块运行需关闭一个

===========================

153 <Directory />
154     Options FollowSymLinks
155     AllowOverride None
156     #Require all denied    此处如果更换端口其他设置没问题192.168.1.12:81无法权限访问更改此处                                                                               
157     Require all granted
158 </Directory>

==========================>

原文地址:https://www.cnblogs.com/acer-haitao/p/8370755.html