Fix installation instructions in readme to actually work, and add missing PHP config file

This commit is contained in:
Alex Cabal 2021-02-07 13:12:30 -06:00
parent c05c4293a8
commit 1148ed74b0
5 changed files with 35 additions and 8 deletions

1
.gitignore vendored
View file

@ -2,7 +2,6 @@ ebooks/*
www/ebooks/* www/ebooks/*
www/images/covers/* www/images/covers/*
www/opds/*.xml www/opds/*.xml
www/opds/subjects
www/rss/*.xml www/rss/*.xml
vendor/ vendor/
composer.lock composer.lock

View file

@ -5,26 +5,28 @@ PHP 7+ is required.
## Installing on Ubuntu 20.04 (Focal) ## Installing on Ubuntu 20.04 (Focal)
```shell ```shell
# Create the site root and clone this repo into it. # Install Apache, PHP, PHP-FPM, and various other dependencies.
sudo apt install -y git composer php-fpm php-cli php-gd php-xml php-apcu php-mbstring php-intl apache2 apache2-utils libfcgi0ldbl task-spooler
# Create the site root and logs root and clone this repo into it.
sudo mkdir /standardebooks.org/ sudo mkdir /standardebooks.org/
sudo chown $(whoami): /standardebooks.org
sudo mkdir /var/log/local/
cd /standardebooks.org/ cd /standardebooks.org/
git clone https://github.com/standardebooks/web/ git clone https://github.com/standardebooks/web/
# Install Apache, PHP, PHP-FPM, and various other dependencies.
sudo apt install -y composer php-fpm php-cli php-gd php-xml php-apcu php-mbstring php-intl apache2 apache2-utils libfcgi0ldbl task-spooler
# Install dependencies using Composer. # Install dependencies using Composer.
cd /standardebooks.org/web/ cd /standardebooks.org/web/
composer install composer install
# Add standardebooks.test to your hosts file. # Add standardebooks.test to your hosts file.
echo "127.0.0.1\tstandardebooks.test" | sudo tee -a /etc/hosts echo -e "127.0.0.1\tstandardebooks.test" | sudo tee -a /etc/hosts
# Create a self-signed SSL certificate for use with the local web site installation. # Create a self-signed SSL certificate for use with the local web site installation.
openssl req -x509 -nodes -days 99999 -newkey rsa:4096 -subj "/CN=standardebooks.test" -keyout /standardebooks.org/web/config/ssl/standardebooks.test.key -sha256 -out /standardebooks.org/web/config/ssl/standardebooks.test.crt openssl req -x509 -nodes -days 99999 -newkey rsa:4096 -subj "/CN=standardebooks.test" -keyout /standardebooks.org/web/config/ssl/standardebooks.test.key -sha256 -out /standardebooks.org/web/config/ssl/standardebooks.test.crt
# Enable the necessary Apache modules. # Enable the necessary Apache modules.
sudo a2enmod {headers, expires, ssl, rewrite, proxy} sudo a2enmod headers expires ssl rewrite proxy proxy_fcgi
# Link and enable the SE Apache configuration file. # Link and enable the SE Apache configuration file.
sudo ln -s /standardebooks.org/web/config/apache/standardebooks.test.conf /etc/apache2/sites-available/ sudo ln -s /standardebooks.org/web/config/apache/standardebooks.test.conf /etc/apache2/sites-available/
@ -32,8 +34,13 @@ sudo a2ensite standardebooks.test
sudo systemctl restart apache2.service sudo systemctl restart apache2.service
# Link and enable the SE PHP-FPM pool. # Link and enable the SE PHP-FPM pool.
sudo ln -s /standardebooks.org/web/config/php/fpm/standardebooks.org.ini /etc/php/*/cli/conf.d/
sudo ln -s /standardebooks.org/web/config/php/fpm/standardebooks.org.ini /etc/php/*/fpm/conf.d/
sudo ln -s /standardebooks.org/web/config/php/fpm/standardebooks.test.conf /etc/php/*/fpm/pool.d/ sudo ln -s /standardebooks.org/web/config/php/fpm/standardebooks.test.conf /etc/php/*/fpm/pool.d/
sudo systemctl restart "php*-fpm.service" sudo systemctl restart "php*-fpm.service"
# Download the OPDS index template
wget -O /standardebooks.org/web/www/opds/index.xml https://standardebooks.org/opds
``` ```
If everything went well you should now be able to open your web browser and visit `https://standardebooks.test/`. However, you wont see any ebooks if you visit `https://standardebooks.test/ebooks/`. To install some ebooks, first you have to clone their source from GitHub, then deploy them to your local website using the `./scripts/deploy-ebook-to-www` script: If everything went well you should now be able to open your web browser and visit `https://standardebooks.test/`. However, you wont see any ebooks if you visit `https://standardebooks.test/ebooks/`. To install some ebooks, first you have to clone their source from GitHub, then deploy them to your local website using the `./scripts/deploy-ebook-to-www` script:

View file

@ -0,0 +1,17 @@
error_log = "/var/log/local/php-error.log"
display_errors = Off
display_startup_errors = Off
html_errors = Off
log_errors = On
short_open_tag = On
error_reporting = E_ALL
max_execution_time = 120
allow_url_fopen = false
allow_url_include = false
expose_php = off
[Date]
date.timezone = Etc/UTC
[opcache]
opcache.validate_timestamps = off

View file

@ -58,7 +58,7 @@ class OpdsFeed{
protected function SaveIfChanged(string $path, string $feed, string $updatedTimestamp): void{ protected function SaveIfChanged(string $path, string $feed, string $updatedTimestamp): void{
$tempFilename = tempnam('/tmp/', 'se-opds-'); $tempFilename = tempnam('/tmp/', 'se-opds-');
file_put_contents($tempFilename, $feed); file_put_contents($tempFilename, $feed);
exec('se clean ' . escapeshellarg($tempFilename)); exec('se clean ' . escapeshellarg($tempFilename) . ' 2>&1', $output); // Capture the result in case there's an error, otherwise it prints to stdout
// Did we actually update the feed? If so, write to file and update the index // Did we actually update the feed? If so, write to file and update the index
if(!is_file($path) || ($this->Sha1Entries($feed) != $this->Sha1Entries(file_get_contents($path)))){ if(!is_file($path) || ($this->Sha1Entries($feed) != $this->Sha1Entries(file_get_contents($path)))){

4
www/opds/subjects/.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore