Showing posts with label nginx. Show all posts
Showing posts with label nginx. Show all posts

Monday, 8 December 2014

Fedora: how to restart nginx and php-fpm

sudo service nginx restart
sudo service php-fpm restart

Monday, 18 August 2014

How To Set Up HTTP Authentication With Nginx

https://www.digitalocean.com/community/tutorials/how-to-set-up-http-authentication-with-nginx-on-ubuntu-12-10

Nginx configuration file error

When restarting nginx after a configuration file change, if you get an error message that the configuration file has an error, you can get more info about the error with:

sudo nginx -t

Tuesday, 17 June 2014

Nginx with CPanel

http://cpxstack.sysally.net/

Cpxstack is a plugin to cPanel that completely replaces Apache with nginx (other plugins keeps apache and configure nginx as a reverse proxy).

To install cpxstack, you need Incron. For this you need to enable the EPEL repository (see previous article for this).

You also need to install php-devel. Cpanel prevents installing any php related packages through an "exclude" entry in yum.conf. Open yum.conf and remove "php*".

After upgrading to the latest stable PHP version, you should enable the Remi repository and the php55 remi repository. You can now install php-devel.

You can run the cpxstack.sh script as per instructions here: http://cpxstack.sysally.net/documentation.htm

For incron and php-devel you can alternatively directly run the cpxstack.sh script to see if it installs these packages automatically.

After the script has run, you should go to WHM, when you click on the cpxstack icon in the sidebar, it will ask you to change a setting in the Tweak Settings area.
You also need to go to cPanel and manually enable nginx for your site. Also in WHM change the default number of worker processes to a lower number (default is 15).

http://www.nginxtips.com/cpxstack-nginx-php-fpm-cpanel/

Nginx: Allow selected IP addresses only

  server {
    listen 80;
    server_name www.foo.bar;

    location / {

      allow   my.public.ip.here;
      deny    all;
    }
  } 
 
You can have multiple "allow" lines.

http://stackoverflow.com/questions/8438867/how-can-i-allow-access-to-a-single-ip-address-via-nginx-conf

Nginx configuration for Wordpress

For wordpress pretty permalinks to work, you need to add this to your nginx.conf file where the wordpress directory is /wordpress:

location /wordpress {
    index index.php index.html index.htm;
    try_files $uri $uri/ /index.php?$args;
}

Nginx configuration for Moodle

If the moodle directory is /moodle then put this in the configuration file nginx.conf or the appropriate file under the nginx.include.d folder:

server {
     server_name  example.com www.example.com;
     rewrite ^/moodle/(.*\.php)(/)(.*)$ /moodle/$1?file=/$3 last;
 
In the same file, in the php section:
 
  location ~ \.php$ {
     fastcgi_split_path_info ^(.+\.php)(/.+)$;
 
 
Putting the same rewrite rule in the location /moodle section does not work.
 
If you are using the cpXstack plugin for cPanel, make sure you follow this:
 
For any domain that has nginX+PHP-FPM enabled, additional nginX configuration can be added by the root user at
/opt/pifpm/nginx.include.d/<DOMAINNAME>.autoinclude where DOMAINNAME is the domain .
 
Changes made any where else may not be preserved during server shut down.