Pārlūkot izejas kodu

Merge pull request #533 from tracim/fix/532/webdav_apache_documentation

Bastien Sevajol 6 gadus atpakaļ
vecāks
revīzija
20234a2d79
Revīzijas autora e-pasts nav piesaistīts nevienam kontam
1 mainītis faili ar 121 papildinājumiem un 30 dzēšanām
  1. 121 30
      doc/apache.md

+ 121 - 30
doc/apache.md Parādīt failu

@@ -2,45 +2,73 @@
2 2
 
3 3
 ### Installation ###
4 4
 
5
-Install `Apache` server and its [`WSGI` module](https://github.com/GrahamDumpleton/mod_wsgi):
5
+Install `tracim` first.
6
+Install `Apache` server and uwsgi  its [`WSGI` module](https://github.com/GrahamDumpleton/mod_wsgi):
6 7
 
7
-    sudo apt install apache2 libapache2-mod-wsgi-py3
8
+    sudo apt install apache2 libapache2-mod-wsgi-py3 uwsgi uwsgi-plugin-python3
8 9
 
9 10
 ### Configuration ###
10 11
 
11 12
 Create a file named `/etc/apache2/sites-available/tracim.conf` containing:
12 13
 
13
-    Listen 8080
14
+    Listen 80
14 15
 
15
-    <VirtualHost *:8080>
16
+    <VirtualHost *:80>
16 17
         ServerName tracim
17 18
 
18
-        # Serve Tracim through WSGI
19
-        WSGIDaemonProcess tracim user=[your_user] group=[your_user] threads=4 python-home=[tracim_path]/tg2env python-path=[tracim_path]/tracim lang='C.UTF-8' locale='C.UTF-8'
20
-        WSGIProcessGroup tracim
21
-        WSGIScriptAlias / [tracim_path]/tracim/app.wsgi process-group=tracim
22
-        <Directory "[tracim_path]/tracim">
23
-            <Files "app.wsgi">
24
-                Require all granted
25
-            </Files>
26
-        </Directory>
27
-
28
-        # Serve static files directly
29
-        Alias /assets          [tracim_path]/tracim/tracim/public/assets
30
-        Alias /_caldavzap      [tracim_path]/tracim/tracim/public/_caldavzap
31
-        Alias /favicon.ico     [tracim_path]/tracim/tracim/public/favicon.ico
32
-        <Directory "[tracim_path]/tracim/tracim/public">
33
-            Require all granted
34
-        </Directory>
19
+    <Directory "/">
20
+        Require all granted
21
+        Dav On
22
+    </Directory>
23
+    ProxyPreserveHost On 
24
+    CustomLog /var/log/apache2/algoo-access.log combined
25
+    ErrorLog /var/log/apache2/algoo-error.log
26
+    <Location "/webdav">
27
+        # Dav On
28
+    </Location>
29
+
30
+    # RemoteIPHeader X-Forwarded-For
31
+    ProxyPass /webdav http://127.0.0.1:3030/webdav
32
+    ProxyPassReverse /webdav http://127.0.0.1:3030/webdav
33
+    ProxyPass / http://127.0.0.1:8080/
34
+    ProxyPassReverse / http://127.0.0.1:8080/
35
+
35 36
     </VirtualHost>
36 37
 
37
-Replace `[tracim_path]` and `[your_user]` above by your tracim installation path and your user.
38
+Enable this configuration file:
39
+
40
+    sudo ln -s /etc/apache2/sites-available/tracim.conf /etc/apache2/sites-enabled/
41
+
42
+Check if you just have `tracim.conf` in `/etc/apache2/sites-enabled`, if not, remove other file.
43
+
44
+
45
+Create the file named `/etc/uwsgi/apps-available/tracim.ini` containing:
46
+
47
+    [uwsgi]
48
+    plugins = python3
49
+    chdir = [tracim_path]/tracim
50
+    home = [tracim_path]/tg2env
51
+    wsgi-file = app.wsgi
52
+    callable = application
53
+    http-socket = 0.0.0.0:8080
54
+    enable-threads = true
55
+    env = PYTHON_EGG_CACHE=/tmp
56
+
57
+Replace [tracim_path] by your path of tracim
38 58
 
39
-Set the `APP_CONFIG` variable of the `tracim/app.wsgi` file to match your tracim installation path:
59
+Enable this configuration file:
60
+
61
+    sudo ln -s /etc/uwsgi/apps-available/tracim.ini /etc/uwsgi/apps-enabled/
62
+
63
+
64
+Create file `tracim.log` in `/var/log/uwsgi/app/`
65
+
66
+Set the `APP_CONFIG` variable of the `[tracim_path]/tracim/app.wsgi` file to match your tracim installation path:
40 67
 
41 68
     # -*- coding: utf-8 -*-
42 69
 
43
-    APP_CONFIG = "[tracim_path]/tracim/development.ini"
70
+    APP_CONFIG = "[tracim_path]/tracim/development.ini" 
71
+    #(in file: replace /var/www/tracim by your [tracim_path] )
44 72
 
45 73
     #Setup logging
46 74
     # import logging
@@ -51,17 +79,80 @@ Set the `APP_CONFIG` variable of the `tracim/app.wsgi` file to match your tracim
51 79
     application = loadapp('config:%s' % APP_CONFIG)
52 80
     application.debug = False
53 81
 
82
+
83
+Add `webdav` at `root_path` in the `[tracim_path]/tracim/wsgidav.conf`:
84
+
85
+    ################################################################################
86
+    # Sample WsgiDAV configuration file
87
+    #
88
+    # 1. Rename this file to `wsgidav.conf`
89
+    # 2. Adjust settings as appropriate
90
+    # 3. Run tracim as you always do :)
91
+    #
92
+    ################################################################################
93
+    
94
+    ################################################################################
95
+    # SERVER OPTIONS
96
+    #===============================================================================
97
+    
98
+    # host  = "localhost"
99
+    # host  = "192.168.0.1"
100
+    host  = "0.0.0.0"
101
+    
102
+    port = 3030
103
+    
104
+    show_history = True
105
+    show_deleted = True
106
+    show_archived = True
107
+    
108
+    manager_locks = True
109
+    
110
+    root_path = ''
111
+    
112
+    #===============================================================================
113
+    # Lock Manager
114
+    #
115
+    # Example: Use PERSISTENT shelve based lock manager
116
+    #from wsgidav.lock_storage import LockStorageShelve
117
+    #locksmanager = LockStorageShelve("wsgidav-locks.shelve")
118
+
119
+
120
+
121
+Open `[tracim_path]/tracim/development.ini` and make some change:
122
+
123
+
124
+    In [server:main] modify IP:
125
+    `host = 127.0.0.1` by `host = 0.0.0.0`
126
+
127
+    For Radical (CalDav server):
128
+    Uncomment `# radicale.server.host = 0.0.0.0`
129
+    Uncomment `# radicale.server.allow_origin = *`
130
+    Uncomment `# radicale.client.base_url.host = http://127.0.0.1:5232`
131
+    and modifiy IP `# radicale.client.base_url.host = http://127.0.0.1:5232`to `radicale.client.base_url.host = http://[Your_server_IP]:5232`
132
+    
133
+    For WSGIDAV
134
+    Uncomment `# wsgidav.client.base_url = 127.0.0.1:<WSGIDAV_PORT>`
135
+    and modify IP and PORT `# wsgidav.client.base_url = 127.0.0.1:<WSGIDAV_PORT>` to `wsgidav.client.base_url = [Your_server_IP]/webdav`
136
+
137
+
138
+Restart `uwsgi` configuration:
139
+
140
+    sudo systemctl restart uwsgi.service
141
+
54 142
 Load needed proxy modules and enable this site configuration file:
55 143
 
56
-    sudo a2enmod proxy proxy_http
144
+    sudo a2enmod dav_fs dav proxy proxy_http
57 145
     sudo a2ensite tracim.conf
58 146
 
59
-Reload `Apache` configuration:
147
+Restart `Apache` configuration:
60 148
 
61
-    sudo systemctl reload apache2.service
149
+    sudo systemctl restart apache2.service
150
+    
151
+**Important**
152
+In case you have some permission problem, check if `www-data` can access to folder of tracim.
62 153
 
63 154
 ## Documentation Links ##
64 155
 
65
-[TurboGears](http://turbogears.readthedocs.io/en/tg2.3.7/cookbook/deploy/mod_wsgi.html)
66
-
67
-[mod_wsgi](http://modwsgi.readthedocs.io/en/develop/index.html)
156
+* [Apache](https://httpd.apache.org/docs/2.4/fr/)
157
+* [TurboGears](http://turbogears.readthedocs.io/en/tg2.3.7/cookbook/deploy/mod_wsgi.html)
158
+* [mod_wsgi](http://modwsgi.readthedocs.io/en/develop/index.html)