Web Servers
By its nature, Siler itself is made to be lightweight and dependent-less. This means you can use whatever web-service technology you want. Here, you'll find a few example configurations for some well-known web-services.
Composer-serve script
Siler's default configuration bundled in the siler/project
template gives a runnable configuration that fits well for development purposes.
You can use it, while being in the root directory of your project (the folder containing your composer.json
file), by running
or, if you didn't install composer globally,
Note: The serve
script stored in the composer.json
file runs php -S 0.0.0.0:8000 -t .
PHP CLI
The PHP CLI can also be enough for small production servers, like for example a raspberry pi running in your home.
To run your website using the PHP CLI, you can use this simple command (adapted to your project):
The {ip/domain}
block
{ip/domain}
blockThe {ip/domain}
block is the interface on which you want your server to listen to.
You have multiple choices:
127.0.0.1
will run it onlocalhost
and you'll be able to access it by going tohttp://127.0.0.1
orhttp://localhost
in your browser.192.168.x.x
(your local IP) will listen to requests coming from your local IP. You can retrieve it on *nix systems by runningifconfig
orip addr
and looking for an IP generally starting with192.168.
.0.0.0.0
will listen to requests coming from every network interface you have on your computer, that'd belocalhost
(the loopback), your local IP and more !
Additionally, the PHP CLI supports real domains, which means you can run your website by specifying the domain name of your computer instead of its local IP.
You can retrieve your computer's domain on *nix systems with the simple command hostname
.
It'll return for example jake-computer
.
You can then use this returned domain as the listening interface: php -S jake-computer[:{port}] -t .
The [:{port}]
block
[:{port}]
blockThe [:{port}]
block is the port you want to bind your process to.
Important: On most *nix systems, you can't set a port below 1025 without running it as root. The usual ports used are
8080
and8000
.
Note: The :{port}
block is optional, but recommended.
Apache
Subfolder
If you want to make this website available under a sub-folder of your Apache server, you'll need to make sure the AllowOverride
contains Options=Multiviews
, like:
Then, in your project's root folder, you can create a simple .htaccess
file containing:
This file will try to see if the file or folder you're trying to access exists in the tree, then if it doesn't exist, it'll redirect the request to the index.php
entry point in your project.
Notes
There are a lot of other web services, like NGINX, LigHTTPD or IIS. If you want to provide a sample configuration for a server that's not listed here, don't hesitate to fork the repo, do your changes, then submit a pull request.
Last updated