Spigot HTTP Server
A basic HTTP Server implementation with PHP gateway support, and global variables based on your spigot instance.
Why did you make this?
A friend of mine has gotten a host which doesn't have Apache/Nginx available to the users, but did have PHPMyAdmin, and PHP available to the user. With that in mind, I developed this plugin so he can run his small server information page with PHP support for fun statistics.
Downloading this Plugin?
Think about writing a short review!
It's much appreciated.
Got bugs in the code?
Rather than leaving a review with bug reports...
Click on the Discussion tab, or send me a Personal Message.
Thank you.
Features
- Allocate IP
- Allocate additional external IPs bound to your system**
- HTTP Port Configurable
- Server Path Configurable
- HTTP 1.1
- Support for many Content-Types**
- PHP Script Support (If installed on your system)
- PHP Path Configurable
- Built-in $_SHS array with info from your Spigot Server.
- $_GET Simulation Wrapper**
- Built-in sample webpage you can customize
Commands
Spigot HTTP Server now comes with commands to control the server. They are simple, and can be executed by someone with the appropriate permissions.
httpd (start|stop|restart|reload)
- start - Starts the server
- stop - Stops the server
- restart - Restarts the server
- reload - Reloads the configuration file
Permissions
Currently there is only one permission node for an admin.
- shs.admin
Installation
Installation is fairly simple:
Requirements:
- Java 8
- Plan to use some RAM towards your http server, so you may plan to allocated RAM + 256MB if available
- (If planning to use PHP in SHS) PHP must be installed, and your PHP Gateway (located in your config.yml) correctly configured to work.
- Create a new folder in your plugins directory called SpigotHttpServer
- Copy and save the example config below to your SpigotHttpServer folder, and edit the settings.
- server-ip - This is the IP your HTTP server will bind to.
- server-port - This is the Port (which must not be already bound) your HTTP Server will bind too.
- server-path - This is the absolute path to your public_html folder. It doesn't need to be in your SpigotHttpServer plugin folder, but it must exist and have the correct permissions for web. If you need help finding your paths you can run this plugin and search your server logs for [SHSPaths] - SHSPaths.jar (You must run this with Spigot HTTP Server installed in plugins folder)
- (Optional) If PHP is installed on your system, you can set php-gateway-enabled to true. Than, you will need to edit the php-path to point to your PHP bin. On most Linux systems it can be left as "php".
- Drop the SpigotHttpServer*.jar into your plugins folder.
- Start your Server
- Visit your website at the desire IP and Port!
Config Example
This is the example config you should use before first starting your server.
Note (Windows): On windows your php-path should point to your php.exe. (You can download PHP form here: http://windows.php.net/download/ or use another instance like WAMPs)
Note (Linux): On linux if you do not know your PHP path you may have to guess if you do not have access to the terminal. If you do, try running: find / -name "php"
Code (YAML):
# Web Server Setup
# Web Site/Network Name
server-name : Spigot HTTP Server
# Web Site/Network Address
server-address : null
# Server IP (Eg localhost / 127.0.0.1 / Bound External IP )
server-ip : 127.0.0.1
# Additional IPs, do not uncomment unless assigning available ips on your network
#additional-ips:
# - 192.168.0.1
# Web Port (Default: 8080)
server-port : 8080
# Server Root Path
# This is where your HTTP server root is. No trailing slash! Examples:
# Windows: C:\Users\Minecraft\Spigot\plugins\SpigotHttpServer\public_html
# Linux: /home/spigot/server/plugins/SpigotHttpServer/public_html
server-path : /home/spigot/server/plugins/SpigotHttpServer/public_html
# Max simultaneous connections
# Considering you are running a small server via a plugin on your
# Spigot Server, considering keeping this low. Connections over this limit
# will be rejected with a 503 Service Unavailable Error.
# Setting this to 0 or 1 will drop all incoming connections serving the 503
max-connections : 200
# Kill Switch
# If this enabled, instead of serving a 503 error when connection limit is
# reached, Spigot HTTP Server will shutdown for X time before returning online
kill-switch-enabled : false
# Kill Switch - Restart Timer (In Ticks)
# [Default: 2400] - 2 Minutes
kill-switch-restart : 2400
# PHP Gateway Enabled
# This shouldn't be enabled if you do not have PHP installed
php-gateway-enabled : false
# PHP Path
# This is the full path, or command to your PHP parser
# Example: /user/bin/php
php-path : php
# SHS Tags Enabled
# SHS Tags incorperates a secondary parser before pages are served and replaces
# Registered types with their corresponding value. You can accesss SHSTags through
# Spigot HTTP Server plugin and add your own custom types.
shstags-enabled : true
# SHS Online Userlist Avatar Size
# [Default: 24]
shstags-avatar-size : 24
# Max HTML Online Player List Count
shstags-max-online-list-shown : 25
# Did we, or do we want to generate the default index
# This is set false for first run to generate an example
generated-index : false
# Web Site/Network Name
server-name : Spigot HTTP Server
# Web Site/Network Address
server-address : null
# Server IP (Eg localhost / 127.0.0.1 / Bound External IP )
server-ip : 127.0.0.1
# Additional IPs, do not uncomment unless assigning available ips on your network
#additional-ips:
# - 192.168.0.1
# Web Port (Default: 8080)
server-port : 8080
# Server Root Path
# This is where your HTTP server root is. No trailing slash! Examples:
# Windows: C:\Users\Minecraft\Spigot\plugins\SpigotHttpServer\public_html
# Linux: /home/spigot/server/plugins/SpigotHttpServer/public_html
server-path : /home/spigot/server/plugins/SpigotHttpServer/public_html
# Max simultaneous connections
# Considering you are running a small server via a plugin on your
# Spigot Server, considering keeping this low. Connections over this limit
# will be rejected with a 503 Service Unavailable Error.
# Setting this to 0 or 1 will drop all incoming connections serving the 503
max-connections : 200
# Kill Switch
# If this enabled, instead of serving a 503 error when connection limit is
# reached, Spigot HTTP Server will shutdown for X time before returning online
kill-switch-enabled : false
# Kill Switch - Restart Timer (In Ticks)
# [Default: 2400] - 2 Minutes
kill-switch-restart : 2400
# PHP Gateway Enabled
# This shouldn't be enabled if you do not have PHP installed
php-gateway-enabled : false
# PHP Path
# This is the full path, or command to your PHP parser
# Example: /user/bin/php
php-path : php
# SHS Tags Enabled
# SHS Tags incorperates a secondary parser before pages are served and replaces
# Registered types with their corresponding value. You can accesss SHSTags through
# Spigot HTTP Server plugin and add your own custom types.
shstags-enabled : true
# SHS Online Userlist Avatar Size
# [Default: 24]
shstags-avatar-size : 24
# Max HTML Online Player List Count
shstags-max-online-list-shown : 25
# Did we, or do we want to generate the default index
# This is set false for first run to generate an example
generated-index : false
SHS HTML Tags
Spigot HTTP Server now comes with a built-in parser for special tags which can output information from your server without the need for PHP and the use of the $_SHS array.
List of Stock SHS Types:
- SERVER_ID - Prints your server ID from server.properties.
- SERVER_NAME - Prints your server name from server.properties.
- SERVER_VERSION - Prints your server version
- SERVER_IP - Prints the server ip from server.properties
- SERVER_PORT - Prints the server port from server.properties
- MAX_PLAYERS - Prints server max player slots from server.properties
- SERVER_MOTD - Prints a non-stylized MOTD from server.properties
- PLAYERS_ONLINE_LIST - Prints a list of characters online with the avatar.
- PLAYERS_ONLINE_COUNT - Prints the count (int) of players online in the server.
Example Tag Usage:
Adding SHS Tags
Spigot HTTP Server now allows you to hook into it's public SHSTags class and add your own SHSTags which can be used for tons of unique features via a simple HTML page.
First add SpigotHttpServer*.jar to your Build Path
Example Plugin:
Code (Java):
import org.bukkit.plugin.java.JavaPlugin ;
// Import SHS Tags
import wa.was.webserver.lib.SHSTags ;
public class SHSTagTest extends JavaPlugin {
@Override
public void onEnable ( ) {
// Add a test value to Spigot HTTP Server's SHSTags
try {
SHSTags. addReplacement ( "test_key", "<p style=\"font-seigh:bold;\">Hello World!</p>" ) ;
} catch ( Exception e ) {
e. printStackTrace ( ) ;
}
// Update the test value
try {
SHSTags. addReplacement ( "test_key", "<p style=\"font-seigh:bold;\">Hello Mars!</p>" ) ;
} catch ( Exception e ) {
e. printStackTrace ( ) ;
}
// Remove a value
try {
if ( SHSTags. containsType ( "test_key" ) ) {
SHSTags. removeReplacement ( "test_key" ) ;
}
} catch ( Exception e ) {
e. printStackTrace ( ) ;
}
// Has value
try {
if ( SHSTags. containsValue ( "<p style=\"font-seigh:bold;\">Hello Mars!</p>" ) ) {
System. out. print ( "I found the value" ) ;
}
} catch ( Exception e ) {
e. printStackTrace ( ) ;
}
}
}
Example PHP "Script"
Spigot HTTP Server only handles PHP through a gateway which uses the PHP parser installed on your system seperately. You must define the path to your PHP bin for this to work. It is not advised to use PHP-CGI. Currently PHP Scripts are limited to the "text/html" content type. You cannot use $_POST, $_GET, $_COOKIE, etc, but I have simulated $_GET with arguments. So you may use $_GET as you normally would in a basic manner.
Code (PHP):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>PHP Test</title>
<style type="text/css">
.center {
width: 400px;
text-align: center;
margin: 150px auto;
font-size: 50px;
}
.center.reset {
font-size: 14px;
text-align: left;
}
</style>
</head>
<body>
<div class="center">
Hello
<?php
/*
# Spigot HTTP Servers's PHP Gateway
# is only using the PHP Parser.
# Because of this, we DO NOT have:
#
# $_POST
# $_GET
# $_COOKIE
#
# Available to us. But we can still
# simulate $_GET...
#
# Spigot HTTP Server takes your URI
# and parses the query string to
# arguments, and then pre-processes
# your PHP file to utilize those
# arguments as a basic $_GET array
#
# */
// Let's print the of the argument world!
// Notice we can use $_GET as per-normal.
echo $_GET [ 'world' ] ;
?>
</div>
<div class="center reset">
<b>Testing built-in $_SHS Globals:</b><br />
<pre> <?php print_r ( $_SHS ) ; ?></pre>
</div>
</body>
</html>
Disclaimer
Spigot HTTP Server is not affiliated with, or endorsed by SpigotMC Pty. Ltd. This software is provided as is, with no warranty or guarantee of it's functionality. You acknowledge you have read this disclaimer upon downloading this software.
Looking for Developers
I am looking for for partners to help expand Spigot HTTP Server into something grand. If you would like to devote time to the Spigot HTTP Server project and help getting it to a fully functioning Apache/Nginx alternative for Spigot server owners. Instead of dedicated resources to service which could have varying impact, a bundle server can be limited dynamically based on the Spigot Servers demands. This is the eventual goal. Spigot HTTP Server already runs on a cached server pool try and be as unobtrusive as possible to my knowledge.
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft versions listed: 1.11, 1.12
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
Spigot HTTP Server (BETA) is a free Minecraft Java mod. Compatible with Minecraft 1.11, 1.12. Downloaded 1,005 times (via Spigot). Download it and open it directly in the game.

![[IMG]](http://proxy.spigotmc.org/c33694e725b7421ead9feafd26c9d1f9e9e06e18?url=https%3A%2F%2Fi.creativecommons.org%2Fl%2Fby-nd%2F4.0%2F80x15.png)