GetSimpleCMS / GetSimpleCMS

GetSimple CMS
http://get-simple.info
GNU General Public License v3.0
392 stars 113 forks source link

NGINX compat (working) #1239

Open webketje opened 6 years ago

webketje commented 6 years ago

Tested and working.

Setup

Procedure

(NB: most of the commands have to be prefixed with sudo)

  1. If not already installed, sudo apt-get install nginx and PHP.
  2. Install all of the following (replace 7.0 with PHP version installed)
    php7.0-xml
    php7.0-SimpleXML
    php7.0-dom
    php7.0-curl
    php7.0-zip
    php7.0-gd
  3. Pull GetSimple into home subdir:
    cd ~/Sites
    mkdir GS34
    git clone https://github.com/GetSimpleCMS/GetSimpleCMS.git GS34
  4. Create symlink to /var/www/nginx/GS34 directory
    ln -s GS34 /var/www/nginx/GS34
  5. Setup NGINX virtual host

    cd /etc/nginx/sites-available
    cp default getsimple.local
    nano getsimple.local

    Edit file with nano. These are the file contents:

    server {
        listen 127.0.0.1;
    
        root /var/www/nginx/GS34;
    
        index index.php index.html;
    
        server_name getsimple.local;
    
        location { 
                try_files $uri $uri/ =404;
        }
    
        location ~ \.php$ {
                include snippets/fastcgi-php.conf;
                include fastcgi_params;
    
                # With php7.0-fpm:
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
        }
    }
  6. Make it available to NGINX & restart
    ln -s getsimple.local ../sites-enabled/getsimple.local
    systemctl restart nginx
  7. Had some difficulties with setting user/group permissions but that's probably due to my limited experience with it. This is what I did:
    cd ~/Sites/GS34
    sudo chown -R www-data:www-data .
    sudo usermod -a -G www-data $USER
    find . -type d -exec chmod 775 {} +
    find . -type f -exec chmod 664 {} +

    Everything worked except fancy-URL related functionality but that's because I didn't specify any location directives.

Perhaps the 'Apache Error' should be replaced by a warning? Status also reports "error" while there is no real error, just not the 'preferred setup' + is clickable but links to nothing.

See also #472 and GS and NGINX

NEXT UP

Migrating Apache .htaccess to NGINX conf files. Options -Indexes directive equivalent sends 403 Forbidden by default in NGINX.

tablatronix commented 6 years ago

please add to https://github.com/GetSimpleCMS/GS_Configs add subfolder, readme, and scripts, perhaps add a package manager to fetch php dependencies ala composer

I agree about warning, but a very severe warning! lol Regardless you are suppose suppress apache warnings in gsconfig if not using apache