Skip to content

Commit 64df318

Browse files
authored
Add static files server (#9294)
Make use of public_html mandatory
1 parent 752b152 commit 64df318

File tree

27 files changed

+644
-557
lines changed

27 files changed

+644
-557
lines changed

.htaccess

Lines changed: 0 additions & 71 deletions
This file was deleted.

INSTALL

Lines changed: 10 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ REQUIREMENTS
3333
INSTALLATION
3434
============
3535

36-
1. Decompress and put this folder somewhere inside your document root.
36+
1. Decompress and put this folder somewhere inside your server's filesystem.
3737
Note: Make sure files have proper owner/group for your setup. If you use
3838
tar command `--no-same-owner` option might be helpful.
3939
2. In case you don't use the so-called "complete" release package,
@@ -46,20 +46,18 @@ INSTALLATION
4646
- run `php composer.phar update --no-dev`
4747
2.2. Install Javascript dependencies by executing `bin/install-jsdeps.sh` script.
4848
2.3. Install some developer tools by executing `npm install`.
49+
2.4. If you use git sources, compile css files for the Elastic skin as described
50+
in the skins/elastic/README.md file.
4951
3. Make sure that the following directories (and the files within)
5052
are writable by the webserver
5153
- /temp
5254
- /logs
5355
4. Create a new database and a database user for Roundcube (see DATABASE SETUP)
54-
5. Point your browser to http://url-to-roundcube/installer/
55-
6. Follow the instructions of the install script (or see MANUAL CONFIGURATION)
56-
7. After creating and testing the configuration, remove the installer directory
57-
------------------------------------------
58-
IMPORTANT: REMOVE THE INSTALLER DIRECTORY!
59-
------------------------------------------
60-
8. If you use git sources, compile css files for the Elastic skin as described
61-
in the skins/elastic/README.md file.
62-
9. Check Known Issues section of this file
56+
5. Configure your HTTP server and point it to Roundcube's public_html directory.
57+
This is the document root.
58+
6. Point your browser to http://url-to-roundcube/installer.php.
59+
7. Follow the instructions of the install script (or see MANUAL CONFIGURATION).
60+
8. Check Known Issues section of this file
6361

6462

6563
CONFIGURATION HINTS
@@ -161,35 +159,6 @@ PHP settings: upload_max_filesize and post_max_size. Read more about PHP
161159
settings at https://github.com/roundcube/roundcubemail/wiki/Installation#php-configuration.
162160

163161

164-
SECURE YOUR INSTALLATION
165-
========================
166-
167-
Access through the webserver to the following directories should be denied:
168-
169-
/config
170-
/temp
171-
/logs
172-
173-
Roundcube uses .htaccess files to protect these directories, so be sure to
174-
allow override of the Limit directives to get them taken into account. The
175-
package also ships a .htaccess file in the root directory which defines some
176-
rewrite rules. In order to properly secure your installation, please enable
177-
mod_rewrite for Apache webserver and double check access to the above listed
178-
directories and their contents is denied.
179-
180-
NOTE: In Apache 2.4, support for .htaccess files has been disabled by
181-
default. Therefore you first need to enable this in your Apache main or
182-
virtual host config by with:
183-
184-
AllowOverride all
185-
186-
For non-apache web servers add equivalent configuration parameters to deny
187-
direct access to these private resources.
188-
189-
It is also recommended to change the document root to <install path>/public_html
190-
after installation if Roundcube runs at root of a dedicated virtual host. This
191-
will automatically keep sensitive files out of reach for http requests.
192-
193162
CONTENT-SECURITY-POLICY
194163
-----------------------
195164

@@ -208,73 +177,8 @@ please refer to the instructions in UPGRADING guide.
208177
OPTIMISING
209178
==========
210179

211-
There are two forms of optimization here, compression and caching, both aimed
212-
at increasing an end user's experience using Roundcube Webmail. Compression
213-
allows the static web pages to be delivered with less bandwidth. The index.php
214-
of Roundcube Webmail already enables compression on its output. The settings
215-
below allow compression to occur for all static files. Caching sets HTTP
216-
response headers that enable a user's web client to understand what is static
217-
and how to cache it.
218-
219-
The caching directives used are:
220-
* Etags - sets at tag so the client can request is the page has changed
221-
* Cache-control - defines the age of the page and that the page is 'public'
222-
This enables clients to cache javascript files that don't have private
223-
information between sessions even if using HTTPS. It also allows proxies
224-
to share the same cached page between users.
225-
* Expires - provides another hint to increase the lifetime of static pages.
226-
227-
For more information refer to RFC 2616.
228-
229-
Side effects:
230-
-------------
231-
These directives are designed for production use. If you are using this in
232-
a development environment you may get horribly confused if your webclient
233-
is caching stuff that you changed on the server. Disabling the expires
234-
parts below should save you some grief.
235-
236-
If you are changing the skins, it is recommended that you copy content to
237-
a different directory apart from 'default'.
238-
239-
Apache:
240-
-------
241-
To enable these features in apache the following modules need to be enabled:
242-
* mod_deflate
243-
* mod_expires
244-
* mod_headers
245-
246-
The optimization is already included in the .htaccess file in the top
247-
directory of your installation.
248-
249-
Lighttpd:
250-
---------
251-
With Lighttpd the addition of Expire: tags by mod_expire is incompatible with
252-
the addition of "Cache-control: public". Using Cache-control 'public' is
253-
used below as it is assumed to give a better caching result.
254-
255-
Enable modules in server.modules:
256-
"mod_setenv"
257-
"mod_compress"
258-
259-
Mod_compress is a server side cache of compressed files to improve its performance.
260-
261-
$HTTP["host"] == "www.example.com" {
262-
263-
static-file.etags = "enable"
264-
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Etag.use-mtimeDetails
265-
etag.use-mtime = "enable"
266-
267-
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModSetEnv
268-
$HTTP["url"] =~ "^/roundcubemail/(plugins|skins|program)" {
269-
setenv.add-response-header = ( "Cache-Control" => "public, max-age=2592000")
270-
}
271-
272-
# http://redmine.lighttpd.net/projects/lighttpd/wiki/Docs:ModCompress
273-
# set compress.cache-dir to somewhere outside the docroot.
274-
compress.cache-dir = var.statedir + "/cache/compress"
275-
276-
compress.filetype = ("text/plain", "text/html", "text/javascript", "text/css", "text/xml", "image/gif", "image/png")
277-
}
180+
Roundcube can be further optimized by using HTTP compression and caching.
181+
HTTP server setup is out of scope for this manual. (TODO: wiki page).
278182

279183

280184
KNOWN ISSUES

UPGRADING

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,23 @@ WARNING: If you use MySQL < 5.7.7 or MariaDB < 10.2.2 make sure to configure it
3131

3232
Updating manually
3333
-----------------
34-
If you don't have shell access to the Roundcube installation or if not running
34+
If you don't have shell access to the Roundcube installation or if do not run
3535
it on a unix system, you need to do the following operations by hand:
3636

37-
1. Replace index.php and all files in
38-
- ./bin/
39-
- ./SQL/
40-
- ./program/
41-
- ./installer/
37+
1. Replace all files in
38+
- bin/
39+
- SQL/
40+
- public_html/
41+
- program/
42+
- installer/
4243
2. Replace the configuration defaults files:
4344
- config/defaults.inc.php
4445
- config/mimetypes.php
4546
3. rsync the contents of the following folders from your installation
4647
directory into the target folder:
47-
./skins/
48-
./plugins/
49-
./vendor/
48+
- skins/
49+
- plugins/
50+
- vendor/
5051
4. Update dependencies:
5152
4a. If you previously installed plugins through composer, update dependencies
5253
by running `php composer.phar update --no-dev`.
@@ -62,7 +63,7 @@ it on a unix system, you need to do the following operations by hand:
6263
4e. If you use git sources, compile css files for the Elastic skin as described
6364
in the skins/elastic/README.md file.
6465
5. Run `./bin/update.sh` from the commandline OR
65-
open http://url-to-roundcube/installer/ in a browser and choose "3 Test config".
66+
open http://url-to-roundcube/installer.php in a browser and choose "3 Test config".
6667
To enable the latter one, you have to temporary set 'enable_installer'
6768
to true in your local config/config.inc.php file.
6869
WARNING: See SQLite database upgrade below.

bin/installto.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ if (strtolower($input) == 'y') {
5858
echo 'Copying files to target location...';
5959

6060
$adds = [];
61-
$dirs = ['bin', 'SQL', 'plugins', 'skins', 'program', 'public_html'];
61+
$dirs = ['bin', 'SQL', 'plugins', 'skins', 'program'];
6262

6363
if (is_dir(INSTALL_PATH . 'vendor') && (!is_file("{$target_dir}/composer.json") || rcmail_install::vendor_dir_untouched($target_dir))) {
6464
$dirs[] = 'vendor';
@@ -77,7 +77,11 @@ if (strtolower($input) == 'y') {
7777
}
7878
}
7979

80-
foreach (['index.php', 'config/defaults.inc.php', 'composer.json-dist', 'jsdeps.json', 'CHANGELOG.md', 'README.md', 'UPGRADING', 'LICENSE', 'INSTALL'] as $file) {
80+
$files = ['config/defaults.inc.php', 'composer.json-dist', 'jsdeps.json',
81+
'CHANGELOG.md', 'README.md', 'UPGRADING', 'LICENSE', 'INSTALL',
82+
'public_html/index.php', 'public_html/installer.php', 'public_html/static.php'];
83+
84+
foreach ($files as $file) {
8185
$source_file = $file === 'composer.json-dist' ? 'composer.json' : $file;
8286
$command = 'rsync -a --out-format=%n ' . INSTALL_PATH . "{$source_file} {$target_dir}/{$file}";
8387

@@ -87,7 +91,7 @@ if (strtolower($input) == 'y') {
8791
}
8892

8993
// Copy .htaccess or .user.ini if needed
90-
foreach (['.htaccess', '.user.ini'] as $file) {
94+
foreach (['public_html/.htaccess', 'public_html/.user.ini'] as $file) {
9195
if (file_exists(INSTALL_PATH . $file)) {
9296
if (!file_exists("{$target_dir}/{$file}") || file_get_contents(INSTALL_PATH . $file) != file_get_contents("{$target_dir}/{$file}")) {
9397
if (copy(INSTALL_PATH . $file, "{$target_dir}/{$file}.new")) {

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"pear/net_smtp": "~1.12.0",
1616
"pear/pear-core-minimal": "~1.10.1",
1717
"roundcube/plugin-installer": "~0.3.5",
18-
"roundcube/rtf-html-php": "^2.1"
18+
"roundcube/rtf-html-php": "^2.1",
19+
"symfony/polyfill-php80": "^1.31"
1920
},
2021
"require-dev": {
2122
"ergebnis/composer-normalize": "^2.13",

config/defaults.inc.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -875,11 +875,7 @@
875875
// <FilesMatch ".(eot|ttf|woff)">
876876
// Header set Access-Control-Allow-Origin "*"
877877
// </FilesMatch>
878-
$config['assets_path'] = '';
879-
880-
// While assets_path is for the browser, assets_dir informs
881-
// PHP code about the location of asset files in filesystem
882-
$config['assets_dir'] = '';
878+
$config['assets_path'] = null;
883879

884880
// Options passed when creating Guzzle HTTP client, used to fetch remote content
885881
// For example:

0 commit comments

Comments
 (0)