Skip to content

Commit ac2a64f

Browse files
committed
Experimental nginx support
1 parent 8ba6d01 commit ac2a64f

File tree

6 files changed

+199
-8
lines changed

6 files changed

+199
-8
lines changed

Diff for: README.md

+55-5
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,69 @@
1313
#### Main Features
1414
- News page, dynamic server status, admin list with status, server viewer, ban list and rules page
1515
- Multiple languages with auto-detection for default language
16+
- PHP 7.0, Apache 2 and nginx support
1617
- Modern and responsive design
1718
- Caching [WIP]
1819
- Free, Open source, under MIT license
1920

2021
### Requirements
21-
- Minimum
22-
- PHP 5.5 or newer
23-
- Installed and enabled ``mbstring`` extension
24-
- Recommended
25-
- Newest stable PHP version
22+
PHP Installation:
23+
- PHP 5.5 or newer (although latest PHP version is highly recommended!)
24+
- Installed and enabled ``mbstring`` extension
25+
26+
Recommended nginx configuration:
27+
- Up-to-date nginx server
28+
- ``enablehta`` in config.php set to ``true``
29+
- nginx config set to the following: (**Remember that you need to adjust this config to suit your server!**)
30+
````
31+
server {
32+
listen 80 default_server;
33+
listen [::]:80 default_server;
34+
35+
root /var/www/html;
36+
37+
# Add index.php to the list if you are using PHP
38+
index index.php index.html index.htm;
39+
40+
server_name _;
41+
42+
location / {
43+
# First attempt to serve request as file, then
44+
# as directory, then fall back to displaying a 404.
45+
try_files $uri $uri/ $uri.html $uri.php$is_args$query_string;
46+
}
47+
48+
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
49+
50+
location ~ \.php$ {
51+
include snippets/fastcgi-php.conf;
52+
53+
# With php7.0-cgi alone:
54+
#fastcgi_pass 127.0.0.1:9000;
55+
# With php7.0-fpm:
56+
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
57+
}
58+
59+
#deny access to .htaccess files, if Apache's document root
60+
#concurs with nginx's one
61+
location ~ /\.ht {
62+
deny all;
63+
}
64+
65+
#error pages - REMEBER TO CHANGE THE PATH!
66+
error_page 403 /path_to_ts-website_please_change_me/errorpages/403.html;
67+
error_page 404 /path_to_ts-website_please_change_me/errorpages/404.html;
68+
error_page 500 502 503 504 /path_to_ts-website_please_change_me/errorpages/500.html;
69+
}
70+
````
71+
72+
Recommended Apache configuration:
2673
- Up-to-date Apache server
2774
- Enabled mod_rewrite (``sudo a2enmod rewrite && service apache2 reload``)
2875
- Enabled support of htaccess
76+
- ``enablehta`` in config.php set to ``true``
77+
78+
**If you experience any problems, make sure that directory ``/var/www`` is writeable.**
2979

3080
<br><br>
3181
<p align="center">

Diff for: config/config.template.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
$config['contact']['title'] = 'Contact the staff';
5858
$config['contact']['text'] = '
5959
<ul class="list-unstyled">
60-
<li>TeamSpeak: <span class="pullright">channel <a href="ts3server://ts.wruczek.top?cid=30">TS-WEBSITE - Support</a></span></li>
60+
<li>TeamSpeak: <span class="pullright">channel <a href="ts3server://ts.wruczek.top?cid=30">Support</a></span></li>
6161
<li>Email: <span class="pullright"><a href="mailto:[email protected]">[email protected]</a></span></li>
6262
<li>GaduGadu: <span class="pullright"><a href="gg:123456789">123456789 <img src="https://status.gadu-gadu.pl/users/status.asp?id=49568758&styl=1"></a></span></li>
6363
<li>Steam: <span class="pullright"><a href="http://steamcommunity.com/id/wruczek">Wruczek</a></span></li>

Diff for: errorpages/403.html

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<!DOCTYPE html>
2+
<html lang="pl">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
9+
<meta name="author" content="Wruczek">
10+
11+
<title>403 - Forbidden</title>
12+
13+
<!-- Icon -->
14+
<link rel="shortcut icon" href="../img/icon/icon-64.png">
15+
16+
<!-- Bootswatch -->
17+
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/superhero/bootstrap.min.css" rel="stylesheet">
18+
19+
<style>
20+
.container {
21+
display: table;
22+
position: absolute;
23+
height: 100%;
24+
width: 100%;
25+
}
26+
27+
.text-center {
28+
display: table-cell;
29+
vertical-align: middle;
30+
}
31+
</style>
32+
</head>
33+
34+
<body>
35+
36+
<div class="container">
37+
<div class="text-center">
38+
<h1>403 <span style="font-size: 32px;color: #9E9E9E">forbidden</span></h1>
39+
<h3>Access to this page is forbidden.</h3>
40+
<br>
41+
<a href="." class="btn btn-primary btn-lg">&larr;&nbsp;&nbsp;&nbsp;Go back</a>
42+
</div>
43+
</div>
44+
45+
</body>
46+
47+
</html>

Diff for: errorpages/404.html

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<!DOCTYPE html>
2+
<html lang="pl">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
9+
<meta name="author" content="Wruczek">
10+
11+
<title>404 - Not found</title>
12+
13+
<!-- Icon -->
14+
<link rel="shortcut icon" href="../img/icon/icon-64.png">
15+
16+
<!-- Bootswatch -->
17+
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/superhero/bootstrap.min.css" rel="stylesheet">
18+
19+
<style>
20+
.container {
21+
display: table;
22+
position: absolute;
23+
height: 100%;
24+
width: 100%;
25+
}
26+
27+
.text-center {
28+
display: table-cell;
29+
vertical-align: middle;
30+
}
31+
</style>
32+
</head>
33+
34+
<body>
35+
36+
<div class="container">
37+
<div class="text-center">
38+
<h1>404 <span style="font-size: 32px;color: #9E9E9E">page not found</span></h1>
39+
<h3>We couldn't find what you were looking for.</h3>
40+
<br>
41+
<a href="." class="btn btn-primary btn-lg">&larr;&nbsp;&nbsp;&nbsp;Go back</a>
42+
</div>
43+
</div>
44+
45+
</body>
46+
47+
</html>

Diff for: errorpages/500.html

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<!DOCTYPE html>
2+
<html lang="pl">
3+
4+
<head>
5+
<meta charset="utf-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1">
8+
9+
<meta name="author" content="Wruczek">
10+
11+
<title>500 - Server Error</title>
12+
13+
<!-- Icon -->
14+
<link rel="shortcut icon" href="../img/icon/icon-64.png">
15+
16+
<!-- Bootswatch -->
17+
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/superhero/bootstrap.min.css" rel="stylesheet">
18+
19+
<style>
20+
.container {
21+
display: table;
22+
position: absolute;
23+
height: 100%;
24+
width: 100%;
25+
}
26+
27+
.text-center {
28+
display: table-cell;
29+
vertical-align: middle;
30+
}
31+
</style>
32+
</head>
33+
34+
<body>
35+
36+
<div class="container">
37+
<div class="text-center">
38+
<h1>500 <span style="font-size: 32px;color: #9E9E9E">server error</span></h1>
39+
<h3>Something went wrong. Try again later.</h3>
40+
<br>
41+
<a href="." class="btn btn-primary btn-lg">&larr;&nbsp;&nbsp;&nbsp;Go back</a>
42+
</div>
43+
</div>
44+
45+
</body>
46+
47+
</html>

Diff for: include/modulecheck.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ function isPHPVersionSupported() {
66
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
77
}
88

9-
return PHP_VERSION_ID >= 50400;
9+
return PHP_VERSION_ID >= 50500;
1010
}
1111

1212
if (!isPHPVersionSupported()) {
1313
$title = 'Unsupported PHP version';
1414

15-
$text = '<p>You are using old, unsupported PHP version.</p><p>Your PHP version: <b>' . phpversion() . '</b>, required PHP version: <b>5.4.0</b>.</p><p>Please update your PHP installation and try again.</p>';
15+
$text = '<p>You are using old, unsupported PHP version.</p><p>Your PHP version: <b>' . phpversion() . '</b>, required PHP version: <b>5.5.0</b>.</p><p>Please update your PHP installation and try again.</p>';
1616

1717
die(showError($title, $text));
1818
}

0 commit comments

Comments
 (0)