• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

Nginx installation guide for Debian Wheezy

Scheduled Pinned Locked Moved
Linux Problems
4
11
3.9k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T
    techworld
    last edited by Aug 20, 2016, 10:27 PM

    Hi all,

    I’m currently using Clonezilla, and would like to try out FOG.
    However, I can’t find a installation guide for Nginx.
    My server is currently running on Nginx, therefore, Apache 2 causing conflict for me.

    Thanks in advance.

    1 Reply Last reply Reply Quote 0
    • W
      Wayne Workman
      last edited by Aug 20, 2016, 11:07 PM

      I’m told that FOG can run on Nginx but takes some doing to get it to work. I wouldn’t know what those doings are.

      Can you not create a VM on this server and install FOG with it’s standard installer and use Apache, or simply provision another server?

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
      Daily Clean Installation Results:
      https://fogtesting.fogproject.us/
      FOG Reporting:
      https://fog-external-reporting-results.fogproject.us/

      1 Reply Last reply Reply Quote 0
      • T
        Tom Elliott
        last edited by Tom Elliott Aug 20, 2016, 7:17 PM Aug 21, 2016, 1:06 AM

        I don’t know that it’s specific to debian or not, but I do run nginx on my dev box simply because my box isn’t all that powerful and I need faster response for testing purposes.

        My methods required a bit of configuration first.

        My example layout:

        Install nginx. This can be found anywhere, but most likely you can just run sudo apt-get install nginx

        Ensure you have php-fpm module installed. sudo apt-get install php5-fpm

        Configure FPM so nginx can access it: You will need to find the www.conf file for fpm.

        For me it’s found under: /etc/php-fpm.d/www.conf I don’t know what it relates to in debian.

        In this www.conf file look for the listen = line. It will likely be set to a socket, but I prefer to use tcp on port 9000. My config for this line reads: listen = 127.0.0.1:9000

        Save the file and start php-fpm service. (sudo service php5-fpm restart).

        Next comes nginx config. My config location is at /etc/nginx/conf.d

        In this folder I created a file called fog.conf.

        Contents of this file are:

        server {
            #Normal web port
            listen 80;
            #SSL Web port
            listen 443 ssl;
            #Where to get the cert -- I have secure setup on my side
            ssl_certificate /path/to/ssl/file.crt;
            #Where to get the key
            ssl_certificate_key /path/to/ssl/file.key;
            #This is important will post copy after this
            include conf.d/*.loc;
            server_name somenameifneeded.com;
            #This sets the web root path for me I don't need /fog trailing.
            root /path/to/web/fog;
            #This enables auto loading of index.php if requested to the root file instead of index.php
            index index.php index.html index.htm;
            #Self explanatory
            ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
            #Turn on my ciphers
            ssl_prefer_server_ciphers on;
            #How to diffie helman information
            ssl_dhparam /path/to/ssl/dhparams.pem;
            #My cipher list (pretty strong I think)
            ssl_cipher 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
            #SSL Session times out in one day
            ssl_session_timeout 1d;
            #SSL Cache getter.
            ssl_session_cache shared:SSL:50m;
            #More header to ensure security
            add_header Strict-Transport-Security max-age=15768000;
        }
        

        The *.loc from earlier:
        You might have other .locs so adjust as needed. For me I only have a file called php.loc
        This is the important bit as it is how it handles php.
        It contains:

        location ~ \.php$ {
            # Zero-day exploit defense.
            try_files $url =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            include fastcgi_params;
            fastcgi_index index.php
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_pass 127.0.0.1:9000;
        }
        

        That’s about it I think. Of course you will need to find your stuff. But this should help you along the way.

        Also, please restart the nginx service so all these things can take affect.

        When this is running, errors are not written to /var/log/httpd or /var/log/apache2. Some errors will be in /var/log/nginx but most relevant bits is found in /var/log/php-fpm/www-error.log

        sudo service nginx restart

        Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

        1 Reply Last reply Reply Quote 0
        • W
          Wayne Workman
          last edited by Aug 21, 2016, 1:18 AM

          #wiki worthy

          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
          Daily Clean Installation Results:
          https://fogtesting.fogproject.us/
          FOG Reporting:
          https://fog-external-reporting-results.fogproject.us/

          1 Reply Last reply Reply Quote 0
          • T
            techworld
            last edited by Aug 21, 2016, 1:22 AM

            Hi,

            I’d set up a few webserver, if you guys can point in me the direction, I think I can set it up.
            If I successfully set it up, I would post my result here.

            In the mean time, we’re getting somewhere here.
            I don’t have /etc/php-fpm.d/www.conf in my server.
            It has these: /etc/php5/fpm$ ls -la total 84 drwxr-xr-x 3 root root 4096 Jun 29 18:19 . drwxr-xr-x 8 root root 4096 Jun 30 19:05 .. lrwxrwxrwx 1 root root 9 Mar 11 19:23 conf.d -> ../conf.d -rw-r--r-- 1 root root 4555 May 22 2015 php-fpm.conf -rw-r--r-- 1 root root 64378 Jun 16 18:12 php.ini drwxr-xr-x 2 root root 4096 Aug 19 13:35 pool.d

            My question is when I follow the instruction, Apache2 is install automatically.
            How do I avoid that?

            W 1 Reply Last reply Aug 21, 2016, 1:30 AM Reply Quote 0
            • W
              Wayne Workman @techworld
              last edited by Aug 21, 2016, 1:30 AM

              @techworld said in Nginx installation guide for Debian Wheezy:

              My question is when I follow the instruction, Apache2 is install automatically.
              How do I avoid that?

              After FOG is installed, open /opt/fog/.fogsettings and remove apache2 from the packages list, save and close. It will then - on next update/reinstall - not install apache.

              However, there are other problems too. The fog installer tries to configure and restart apache. You’ll probably need to just comment those lines out.

              Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
              Daily Clean Installation Results:
              https://fogtesting.fogproject.us/
              FOG Reporting:
              https://fog-external-reporting-results.fogproject.us/

              T 1 Reply Last reply Aug 21, 2016, 1:39 AM Reply Quote 0
              • T
                techworld @Wayne Workman
                last edited by techworld Aug 20, 2016, 7:56 PM Aug 21, 2016, 1:39 AM

                @Wayne-Workman

                I think I found the php-fpm setting for Nginx:

                upstream php-handler {
                    server 127.0.0.1:9000;
                    #server unix:/var/run/php5-fpm.sock;
                

                So there is no other way to avoid Apache2 install prior to the installion?
                I don’t want Apache2 mess it up with my Nginx.
                I tried earlier today, and it screw me up.

                Another thing I notice that since we save (upload) images to the server, we need to define the client max size too, right?
                Maybe like this ?

                client_max_body_size 20m;
                client_body_buffer_size 128k;```
                1 Reply Last reply Reply Quote 0
                • J
                  Joe Schmitt Senior Developer
                  last edited by Joe Schmitt Aug 21, 2016, 8:29 AM Aug 21, 2016, 2:15 PM

                  @techworld I also run my dev servers on nginx. Here is my upgrade-fog.sh script for CentOS:

                  #!/bin/bash
                  echo
                  echo ===========================================================
                  echo Stopping nginx
                  echo ===========================================================
                  echo
                  
                  systemctl stop nginx
                  
                  echo
                  echo ===========================================================
                  echo Upgrading FOG
                  echo ==========================================================
                  echo
                  
                  cd /opt/fogproject
                  git pull
                  cd /opt/fogproject/bin
                  ./installfog.sh -y
                  
                  echo
                  echo ===========================================================
                  echo Reconfiguring Web Server
                  echo ===========================================================
                  echo
                  
                  systemctl stop httpd
                  systemctl disable httpd
                  systemctl start nginx
                  
                  echo
                  

                  As you can see I leave apache (httpd) installed, but I just disable the service. As for uploading images, that is done through NFS, and not http(s) (nginx).

                  And the nginx configuration Tom posted is exactly what you should be using. We (and some google fu) made it together when porting our servers to nginx and it works flawlessly for us.

                  Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                  T 1 Reply Last reply Aug 21, 2016, 2:53 PM Reply Quote 1
                  • T
                    techworld @Joe Schmitt
                    last edited by Aug 21, 2016, 2:53 PM

                    @Joe-Schmitt
                    Hi,
                    I’m not concern about the upgrade process right now.
                    Do I follow Wayne’s guide to remove Apache2 after the installation in order for Nginx to work?

                    1 Reply Last reply Reply Quote 0
                    • J
                      Joe Schmitt Senior Developer
                      last edited by Joe Schmitt Aug 21, 2016, 8:54 AM Aug 21, 2016, 2:54 PM

                      Just follow the end of my upgrade script (obviously you will need to alter it for Debian). Simply stop and disable Apache, there is no need to uninstall it.

                      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                      T 1 Reply Last reply Aug 21, 2016, 2:59 PM Reply Quote 1
                      • T
                        techworld @Joe Schmitt
                        last edited by techworld Aug 21, 2016, 12:29 PM Aug 21, 2016, 2:59 PM

                        I installed FOG again, and same issue happened.

                        1. /opt/fog/.fogsettings is nowhere to be found.

                        2. Can’t find the proper file to stop apache2.

                        drwxr-xr-x 8 root root 4096 Aug 21 14:10 …
                        drwxr-xr-x 2 fog fog 4096 Aug 21 14:10 bin
                        -rwxr-xr-x 1 fog fog 27695 Jul 20 2014 changelog.txt
                        drwxr-xr-x 3 fog fog 4096 Aug 21 14:10 FOGCrypt
                        drwxr-xr-x 4 fog fog 4096 Jul 21 2014 FOG Service
                        -rwxr-xr-x 1 fog fog 1419 May 28 2014 installation.txt
                        drwxr-xr-x 2 fog fog 4096 Aug 21 14:10 kernel
                        drwxr-xr-x 5 fog fog 4096 Jul 21 2014 lib
                        -rwxr-xr-x 1 fog fog 35147 Feb 12 2008 license.txt
                        drwxr-xr-x 6 fog fog 4096 Jul 21 2014 packages
                        drwxr-xr-x 2 fog fog 4096 Aug 21 14:11 rpttmp
                        drwxr-xr-x 7 fog fog 4096 Jul 21 2014 src
                        drwxr-xr-x 7 fog fog 4096 Aug 21 14:10 utils ```

                        1. This is installation error message: ```

                        Configuring services.

                        • Setting up and starting MySql…OK

                        • Backing up user reports…OK

                        • Did you leave the mysql password blank during install? (Y/n) n

                        • Please enter your mysql password:

                        • Please re-enter your mysql password:

                        • Setting up and starting Apache Web Server…Failed!
                          Script done, file is /var/log/foginstall.log ```

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        1 / 1
                        • First post
                          1/11
                          Last post

                        158

                        Online

                        12.0k

                        Users

                        17.3k

                        Topics

                        155.2k

                        Posts
                        Copyright © 2012-2024 FOG Project