Permalink
Browse files

Experimental nginx support

  • Loading branch information...
1 parent 8ba6d01 commit ac2a64fa6d491309c6406b5a605f89d0d826f839 @Wruczek committed Sep 27, 2016
Showing with 199 additions and 8 deletions.
  1. +55 −5 README.md
  2. +1 −1 config/config.template.php
  3. +47 −0 errorpages/403.html
  4. +47 −0 errorpages/404.html
  5. +47 −0 errorpages/500.html
  6. +2 −2 include/modulecheck.php
View
@@ -13,19 +13,69 @@
#### Main Features
- News page, dynamic server status, admin list with status, server viewer, ban list and rules page
- Multiple languages with auto-detection for default language
+- PHP 7.0, Apache 2 and nginx support
- Modern and responsive design
- Caching [WIP]
- Free, Open source, under MIT license
### Requirements
-- Minimum
- - PHP 5.5 or newer
- - Installed and enabled ``mbstring`` extension
-- Recommended
- - Newest stable PHP version
+PHP Installation:
+- PHP 5.5 or newer (although latest PHP version is highly recommended!)
+- Installed and enabled ``mbstring`` extension
+
+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
- Enabled mod_rewrite (``sudo a2enmod rewrite && service apache2 reload``)
- 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>
<p align="center">
@@ -57,7 +57,7 @@
$config['contact']['title'] = 'Contact the staff';
$config['contact']['text'] = '
<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>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>
View
@@ -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>
View
@@ -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>
View
@@ -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>
@@ -6,13 +6,13 @@ function isPHPVersionSupported() {
define('PHP_VERSION_ID', ($version[0] * 10000 + $version[1] * 100 + $version[2]));
}
- return PHP_VERSION_ID >= 50400;
+ return PHP_VERSION_ID >= 50500;
}
if (!isPHPVersionSupported()) {
$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));
}

0 comments on commit ac2a64f

Please sign in to comment.