Grav with OpenLiteSpeed Web Server?

I’m currently running Grav with Nginx on my OS X 10.9.5 localhost and my servers (OpenBSD and Raspberry Pi). Nginx and APC cache help with the Pi’s performance – rhukster mentioned on Gitter that he tried LiteSpeed (I wasn’t sure if it was OpenLiteSpeed or if it was with WireNine Hosting) and that it was fast so I’m thinking about using in on the Pi and possibly on my localhost. Before I start delving more into it, I’m wondering if anyone is running Grav with OpenLiteSpeed Web Server (http://open.litespeedtech.com/), or if there is an OpenLiteSpeed sample config, post/tips or similar?

I’ve not tried OpenLiteSpeed, only the regular commercial product as provided by WireNine. However, performance is impressive! Also it’s totally apache compatible so .htaccess just works. Infact you won’t even know it’s another web server. Very impressed.

OpenLiteSpeed doesn’t have all the caching stuff of the commercial version, and it has some connection limits, but I’m sure it’s still better than Nginx or Apache.

Thanks! That sounds very promising. I will try OpenLiteSpeed…

Gday duskop, were you using a Vhost in Nginx? I can’t seem to get grav to work with one…

You can see my .conf here https://community.centminmod.com/threads/grav-flat-file-cms.1958/#post-9341

Hi driedfigs, Yes - Here’s my Nginx chost config – without tweaking for performance.

server {
   listen 80;
   server_name yourservername.com;
   root /path/to/your/webroot/grav;
   #index index.html index.htm index.php;
   # NOTE: Should be already in the http block. If so, not needed here.

   location / {
       try_files $uri $uri/ /index.php?$query_string;
   }

   location ~* \.php$ {
       fastcgi_split_path_info ^(.+\.php)(/.+)$;
       fastcgi_index              index.php;
       fastcgi_pass               unix:/var/run/php5-fpm.sock;
       fastcgi_param              SCRIPT_FILENAME  $document_root$fastcgi_script_name;
       include                    fastcgi_params; 
       fastcgi_param              SCRIPT_FILENAME $request_filename;
   }
}

Great, going to give that a go now :slight_smile: Thanks

No problem!

Hmm getting a 502 Bad Gateway

http://www.nginxtips.com/502-bad-gateway-using-nginx/

My error log shows

PHP message: PHP Fatal error:  Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/home/nginx/domains/mydomain.com.au/public/logs/grav.log" could not be opened: failed to open stream: Permission denied' in /home/nginx/domains/mydomain.com.au/public/vendor/monolog/monolog/src/ Monolog/Handler/StreamHandler.php:84
Stack trace:
#0 /home/nginx/domains/mydomain.com.au/public/vendor/monolog/monolog/src/ Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\Handler\StreamHandler->write(Array)
#1 /home/nginx/domains/mydomain.com.au/public/vendor/monolog/monolog/src/ Monolog/Logger.php(263): Monolog\Handler\AbstractProcessingHandler->handle(Array)
#2 /home/nginx/domains/mydomain.com.au/public/vendor/monolog/monolog/src/ Monolog/Logger.php(339): Monolog\Logger->addRecord(500, 'Uncaught except...', Array)
#3 /home/nginx/domains/mydomain.com.au/public/system/src/Grav/Common/Serv ice/ErrorServiceProvider.php(34): Monolog\Logger->addCritical('Unc
2014/12/03 14:29:01 [crit] 2344#0: *1 connect() to unix:/var/run/php5-fpm.sock fai led (2: No such file or directory) while connecting to upstream, client: 27.32.149.231, server: mydomain.com.au, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mydomain.com.au"
2014/12/03 14:29:03 [crit] 2344#0: *1 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 27.32.149.231, server: mydomain.com.au, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "mydomain.com.au"
2014/12/03 14:29:40 [crit] 2344#0: *8 connect() to unix:/var/run/php5-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 123.243.176.8, server: mydomain.com.au, request: "GET /favicon.ico HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "www.mydomain.com.au"
---

It seems to be related to file permissions.
Can you try:

sudo find /home/nginx/domains/mydomain.com.au/public -type d -exec chmod 0775 {} \;
sudo find /home/nginx/domains/mydomain.com.au/public -type f -exec chmod 0664 {} \;
sudo chown -R youruser:your_web_user /home/nginx/domains/mydomain.com.au/public

You might want to check with Grav author, rhukster, whether these permissions are as expected.

Yah, im not very familiar with Nginx, but I always run Apache as my user so there are no permission issues. You just need to make sure that your Nginx server has permission to write to the directories.

Great, just did the file permissions above and it worked :slight_smile: so far :slight_smile:

Thanks all :slight_smile:

Np!
Thanks rhukster for the Great app and documentation/blog!
I have been planning to start using git for a long time but couldn’t find a nice tutorial… I just started using Git and Bitbucket after reading Grav development blog posts.

Glad your liking it :slight_smile: Makes all the long hours worth while!

Hey guys, after getting the “Grav is Running!” page up using the git clone and bin/grav install, I continued onto the basic tutorial on creating a page, which I created and it shows in the menu, though when clicking the link it gets a nginx 404. My guess is perhaps the rewrite rules aren’t working. Do you guys ever intend on officially supporting Nginx? from my experience it is much light and faster that Apache… @rhukster

I have done some limited testing and came away disappointed with Nginx. I had heard so much good stuff about it, but it seems no faster than Apache 2.4 (infact a little slower).

The trade off with ease of use makes Apache the better option for development IMHO. None of our dev team uses Nginx daily so it’s not easy for us to support that as well as Apache. However, this is a fully open source project so the hope is, people who have experience will continue to provide updated configurations and documentation as needed. That’s the beauty of open source right?

BTW, I think the best performing option is LiteSpeed, or even OpenLiteSpeed as they definitely do seem faster than either Apache or Nginx.

Yes - OpenLiteSpeed sounds very promising and I’m planning to test it this or next week.

I encountered some initial hiccups while configuring Nginx and it’s now working fine on my multiple setups: localhost on OS X 10.9.5, OpenBSD 5.5 server, Raspberry Pi Raspbian. I haven’t compared its speed/performance with Apache – I used it because I had limited choice of web servers available and also just wanted to try it.

While I’m not an Nginx expert, I would be happy to help and can provide my Nginx configuration - it’s smaller than nginx.conf sample.