Experimental nginx support

This commit is contained in:
Wruczek 2016-09-28 01:20:56 +02:00
parent 8ba6d012f5
commit ac2a64fa6d
6 changed files with 199 additions and 8 deletions

View File

@ -13,19 +13,69 @@
#### Main Features #### Main Features
- News page, dynamic server status, admin list with status, server viewer, ban list and rules page - News page, dynamic server status, admin list with status, server viewer, ban list and rules page
- Multiple languages with auto-detection for default language - Multiple languages with auto-detection for default language
- PHP 7.0, Apache 2 and nginx support
- Modern and responsive design - Modern and responsive design
- Caching [WIP] - Caching [WIP]
- Free, Open source, under MIT license - Free, Open source, under MIT license
### Requirements ### Requirements
- Minimum PHP Installation:
- PHP 5.5 or newer - PHP 5.5 or newer (although latest PHP version is highly recommended!)
- Installed and enabled ``mbstring`` extension - Installed and enabled ``mbstring`` extension
- Recommended
- Newest stable PHP version Recommended nginx configuration:
- Up-to-date nginx server
- ``enablehta`` in config.php set to ``true``
- nginx config set to the following: (**Remember that you need to adjust this config to suit your server!**)
````
server {
listen 80 default_server;
listen [::]:80 default_server;
root /var/www/html;
# Add index.php to the list if you are using PHP
index index.php index.html index.htm;
server_name _;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ $uri.html $uri.php$is_args$query_string;
}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
location ~ \.php$ {
include snippets/fastcgi-php.conf;
# With php7.0-cgi alone:
#fastcgi_pass 127.0.0.1:9000;
# With php7.0-fpm:
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
#deny access to .htaccess files, if Apache's document root
#concurs with nginx's one
location ~ /\.ht {
deny all;
}
#error pages - REMEBER TO CHANGE THE PATH!
error_page 403 /path_to_ts-website_please_change_me/errorpages/403.html;
error_page 404 /path_to_ts-website_please_change_me/errorpages/404.html;
error_page 500 502 503 504 /path_to_ts-website_please_change_me/errorpages/500.html;
}
````
Recommended Apache configuration:
- Up-to-date Apache server - Up-to-date Apache server
- Enabled mod_rewrite (``sudo a2enmod rewrite && service apache2 reload``) - Enabled mod_rewrite (``sudo a2enmod rewrite && service apache2 reload``)
- Enabled support of htaccess - Enabled support of htaccess
- ``enablehta`` in config.php set to ``true``
**If you experience any problems, make sure that directory ``/var/www`` is writeable.**
<br><br> <br><br>
<p align="center"> <p align="center">

View File

@ -57,7 +57,7 @@ $config["adminlist"] = array(6, 17, 19);
$config['contact']['title'] = 'Contact the staff'; $config['contact']['title'] = 'Contact the staff';
$config['contact']['text'] = ' $config['contact']['text'] = '
<ul class="list-unstyled"> <ul class="list-unstyled">
<li>TeamSpeak: <span class="pullright">channel <a href="ts3server://ts.wruczek.top?cid=30">TS-WEBSITE - Support</a></span></li> <li>TeamSpeak: <span class="pullright">channel <a href="ts3server://ts.wruczek.top?cid=30">Support</a></span></li>
<li>Email: <span class="pullright"><a href="mailto:kontakt@email.com">konakt@email.com</a></span></li> <li>Email: <span class="pullright"><a href="mailto:kontakt@email.com">konakt@email.com</a></span></li>
<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> <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>
<li>Steam: <span class="pullright"><a href="http://steamcommunity.com/id/wruczek">Wruczek</a></span></li> <li>Steam: <span class="pullright"><a href="http://steamcommunity.com/id/wruczek">Wruczek</a></span></li>

47
errorpages/403.html Normal file
View File

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Wruczek">
<title>403 - Forbidden</title>
<!-- Icon -->
<link rel="shortcut icon" href="../img/icon/icon-64.png">
<!-- Bootswatch -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/superhero/bootstrap.min.css" rel="stylesheet">
<style>
.container {
display: table;
position: absolute;
height: 100%;
width: 100%;
}
.text-center {
display: table-cell;
vertical-align: middle;
}
</style>
</head>
<body>
<div class="container">
<div class="text-center">
<h1>403 <span style="font-size: 32px;color: #9E9E9E">forbidden</span></h1>
<h3>Access to this page is forbidden.</h3>
<br>
<a href="." class="btn btn-primary btn-lg">&larr;&nbsp;&nbsp;&nbsp;Go back</a>
</div>
</div>
</body>
</html>

47
errorpages/404.html Normal file
View File

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Wruczek">
<title>404 - Not found</title>
<!-- Icon -->
<link rel="shortcut icon" href="../img/icon/icon-64.png">
<!-- Bootswatch -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/superhero/bootstrap.min.css" rel="stylesheet">
<style>
.container {
display: table;
position: absolute;
height: 100%;
width: 100%;
}
.text-center {
display: table-cell;
vertical-align: middle;
}
</style>
</head>
<body>
<div class="container">
<div class="text-center">
<h1>404 <span style="font-size: 32px;color: #9E9E9E">page not found</span></h1>
<h3>We couldn't find what you were looking for.</h3>
<br>
<a href="." class="btn btn-primary btn-lg">&larr;&nbsp;&nbsp;&nbsp;Go back</a>
</div>
</div>
</body>
</html>

47
errorpages/500.html Normal file
View File

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="Wruczek">
<title>500 - Server Error</title>
<!-- Icon -->
<link rel="shortcut icon" href="../img/icon/icon-64.png">
<!-- Bootswatch -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/superhero/bootstrap.min.css" rel="stylesheet">
<style>
.container {
display: table;
position: absolute;
height: 100%;
width: 100%;
}
.text-center {
display: table-cell;
vertical-align: middle;
}
</style>
</head>
<body>
<div class="container">
<div class="text-center">
<h1>500 <span style="font-size: 32px;color: #9E9E9E">server error</span></h1>
<h3>Something went wrong. Try again later.</h3>
<br>
<a href="." class="btn btn-primary btn-lg">&larr;&nbsp;&nbsp;&nbsp;Go back</a>
</div>
</div>
</body>
</html>

View File

@ -6,13 +6,13 @@ function isPHPVersionSupported() {
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2])); define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
} }
return PHP_VERSION_ID >= 50400; return PHP_VERSION_ID >= 50500;
} }
if (!isPHPVersionSupported()) { if (!isPHPVersionSupported()) {
$title = 'Unsupported PHP version'; $title = 'Unsupported PHP version';
$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>'; $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>';
die(showError($title, $text)); die(showError($title, $text));
} }