First time setting up PHP-FPM User Pool… is this config a security risk?nginx not able to connect to php-fpm socketNginx and Frog CMS admin urlWhy the php-cgi wrapper script for php-fpm? (Using virtualhost and suexec.)PHP-FPM with Apache 2.2.22 and Ubuntu 12.10 - 500 Error, or returns text (not executing)Cannot recompile PHP on Mac OS X and enable PHP calendarService php-fpm does not get user permissionsAmazon Linux with PHP7 and nginx doesn't load phpAPACHE SetEnv directive (from .htaccess) not send to CGI processSetting up php7.0-fpm + Apache and multi-user pools: Only 1 site worksSuexec/Apache user is not php-fpm 'user'

Why is 150k or 200k jobs considered good when there's 300k+ births a month?

What does "Puller Prush Person" mean?

Rock identification in KY

Did Shadowfax go to Valinor?

Why doesn't H₄O²⁺ exist?

How does quantile regression compare to logistic regression with the variable split at the quantile?

Can a vampire attack twice with their claws using Multiattack?

Is it possible to run Internet Explorer on OS X El Capitan?

Today is the Center

Are astronomers waiting to see something in an image from a gravitational lens that they've already seen in an adjacent image?

What's the output of a record needle playing an out-of-speed record

Are the number of citations and number of published articles the most important criteria for a tenure promotion?

How can I make my BBEG immortal short of making them a Lich or Vampire?

Do I have a twin with permutated remainders?

Does an object always see its latest internal state irrespective of thread?

LaTeX: Why are digits allowed in environments, but forbidden in commands?

Why do I get two different answers for this counting problem?

A case of the sniffles

Can a Cauchy sequence converge for one metric while not converging for another?

Client team has low performances and low technical skills: we always fix their work and now they stop collaborate with us. How to solve?

What defenses are there against being summoned by the Gate spell?

Which country benefited the most from UN Security Council vetoes?

Malformed Address '10.10.21.08/24', must be X.X.X.X/NN or

Convert two switches to a dual stack, and add outlet - possible here?



First time setting up PHP-FPM User Pool… is this config a security risk?


nginx not able to connect to php-fpm socketNginx and Frog CMS admin urlWhy the php-cgi wrapper script for php-fpm? (Using virtualhost and suexec.)PHP-FPM with Apache 2.2.22 and Ubuntu 12.10 - 500 Error, or returns text (not executing)Cannot recompile PHP on Mac OS X and enable PHP calendarService php-fpm does not get user permissionsAmazon Linux with PHP7 and nginx doesn't load phpAPACHE SetEnv directive (from .htaccess) not send to CGI processSetting up php7.0-fpm + Apache and multi-user pools: Only 1 site worksSuexec/Apache user is not php-fpm 'user'






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















After some fooling around with PHP-FPM user pools, I got a configuration that works... but is right?



I'm self hosting a PrivateBin. Obviously, I'm trying to get this install as secure as possible but this is my first time setting up PHP-FPM user pools.



Following these instructions I setup the permissions. My concern is that this app won't run without write and execute privileges to the traffic_limiter.php file located in the data directory. This obviously concerns me.



User Configuration
I created a user called privatebin and also created the appropriate pool in /etc/php/7.2/fpm/pool.d/privatebin.conf.



[privatebin]
user = privatebin
group = privatebin
listen = /run/php/php7.0-fpm.privatebin.sock
listen.owner = privatebin
listen.group = www-data
listen.mode = 0660

pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3


I also added the following to the virtual host file.



 <IfModule mod_fastcgi.c>
AddHandler php7-fcgi-privatebin .php
Action php7-fcgi-privatebin /php7-fcgi-privatebin
Alias /php7-fcgi-privatebin /usr/lib/cgi-bin/php7-fcgi-privatebin
FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi-privatebin -socket /run/php/php7.0-fpm.privatebin.sock -pass-header Authorization
<Directory "/usr/lib/cgi-bin">
Require all granted
</Directory>
</IfModule>

<Directory /var/www/bin.xxxx.io/html>
Options +SymLinksIfOwnerMatch
AllowOverride None

Require all granted
RewriteEngine On
<IfModule mod_fastcgi.c>
<FilesMatch ".+.ph(p[3457]?|t|tml)$">
SetHandler php7-fcgi-privatebin
</FilesMatch>
</IfModule>
</Directory>


The pooled user appears to be working.



#$ps aux | grep php
private+ 1532 0.0 0.1 717056 22780 ? S 11:22 0:00 php-fpm: pool privatebin
private+ 1533 0.0 0.1 717056 22780 ? S 11:22 0:00 php-fpm: pool privatebin
www-data 1534 0.0 0.9 806716 149296 ? S 11:22 0:05 php-fpm: pool www
www-data 1539 0.0 0.9 1041968 150420 ? S 11:22 0:03 php-fpm: pool www
www-data 2299 0.0 0.8 1039040 144136 ? S 12:25 0:02 php-fpm: pool www


Finally... here are the file permissions.



/var/www/html
dr-xr-x--- 2 root www-data 4096 Apr 2 11:20 cfg/
dr-xr-x--- 4 root www-data 4096 Aug 11 2018 css/
drwxr-x--- 2 privatebin www-data 4096 Apr 2 13:04 data/
dr-xr-x--- 2 root www-data 4096 Aug 11 2018 i18n/
dr-xr-x--- 2 root www-data 4096 Aug 11 2018 img/

/var/www/html/data
-rw-r----- 1 privatebin www-data 19 Apr 2 13:04 .htaccess
-rwxrw---- 1 privatebin www-data 45 Apr 2 13:26 purge_limiter.php*
-rwxrw---- 1 privatebin www-data 522 Apr 2 06:57 salt.php*
-rwxrw---- 1 privatebin www-data 130 Apr 2 13:26 traffic_limiter.php*


As I said, this appears to be working, but I had to fiddle with the user permission to get them right. An advise is greatly appreciated.










share|improve this question







New contributor




Eddie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


























    0















    After some fooling around with PHP-FPM user pools, I got a configuration that works... but is right?



    I'm self hosting a PrivateBin. Obviously, I'm trying to get this install as secure as possible but this is my first time setting up PHP-FPM user pools.



    Following these instructions I setup the permissions. My concern is that this app won't run without write and execute privileges to the traffic_limiter.php file located in the data directory. This obviously concerns me.



    User Configuration
    I created a user called privatebin and also created the appropriate pool in /etc/php/7.2/fpm/pool.d/privatebin.conf.



    [privatebin]
    user = privatebin
    group = privatebin
    listen = /run/php/php7.0-fpm.privatebin.sock
    listen.owner = privatebin
    listen.group = www-data
    listen.mode = 0660

    pm = dynamic
    pm.max_children = 5
    pm.start_servers = 2
    pm.min_spare_servers = 1
    pm.max_spare_servers = 3


    I also added the following to the virtual host file.



     <IfModule mod_fastcgi.c>
    AddHandler php7-fcgi-privatebin .php
    Action php7-fcgi-privatebin /php7-fcgi-privatebin
    Alias /php7-fcgi-privatebin /usr/lib/cgi-bin/php7-fcgi-privatebin
    FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi-privatebin -socket /run/php/php7.0-fpm.privatebin.sock -pass-header Authorization
    <Directory "/usr/lib/cgi-bin">
    Require all granted
    </Directory>
    </IfModule>

    <Directory /var/www/bin.xxxx.io/html>
    Options +SymLinksIfOwnerMatch
    AllowOverride None

    Require all granted
    RewriteEngine On
    <IfModule mod_fastcgi.c>
    <FilesMatch ".+.ph(p[3457]?|t|tml)$">
    SetHandler php7-fcgi-privatebin
    </FilesMatch>
    </IfModule>
    </Directory>


    The pooled user appears to be working.



    #$ps aux | grep php
    private+ 1532 0.0 0.1 717056 22780 ? S 11:22 0:00 php-fpm: pool privatebin
    private+ 1533 0.0 0.1 717056 22780 ? S 11:22 0:00 php-fpm: pool privatebin
    www-data 1534 0.0 0.9 806716 149296 ? S 11:22 0:05 php-fpm: pool www
    www-data 1539 0.0 0.9 1041968 150420 ? S 11:22 0:03 php-fpm: pool www
    www-data 2299 0.0 0.8 1039040 144136 ? S 12:25 0:02 php-fpm: pool www


    Finally... here are the file permissions.



    /var/www/html
    dr-xr-x--- 2 root www-data 4096 Apr 2 11:20 cfg/
    dr-xr-x--- 4 root www-data 4096 Aug 11 2018 css/
    drwxr-x--- 2 privatebin www-data 4096 Apr 2 13:04 data/
    dr-xr-x--- 2 root www-data 4096 Aug 11 2018 i18n/
    dr-xr-x--- 2 root www-data 4096 Aug 11 2018 img/

    /var/www/html/data
    -rw-r----- 1 privatebin www-data 19 Apr 2 13:04 .htaccess
    -rwxrw---- 1 privatebin www-data 45 Apr 2 13:26 purge_limiter.php*
    -rwxrw---- 1 privatebin www-data 522 Apr 2 06:57 salt.php*
    -rwxrw---- 1 privatebin www-data 130 Apr 2 13:26 traffic_limiter.php*


    As I said, this appears to be working, but I had to fiddle with the user permission to get them right. An advise is greatly appreciated.










    share|improve this question







    New contributor




    Eddie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      0












      0








      0








      After some fooling around with PHP-FPM user pools, I got a configuration that works... but is right?



      I'm self hosting a PrivateBin. Obviously, I'm trying to get this install as secure as possible but this is my first time setting up PHP-FPM user pools.



      Following these instructions I setup the permissions. My concern is that this app won't run without write and execute privileges to the traffic_limiter.php file located in the data directory. This obviously concerns me.



      User Configuration
      I created a user called privatebin and also created the appropriate pool in /etc/php/7.2/fpm/pool.d/privatebin.conf.



      [privatebin]
      user = privatebin
      group = privatebin
      listen = /run/php/php7.0-fpm.privatebin.sock
      listen.owner = privatebin
      listen.group = www-data
      listen.mode = 0660

      pm = dynamic
      pm.max_children = 5
      pm.start_servers = 2
      pm.min_spare_servers = 1
      pm.max_spare_servers = 3


      I also added the following to the virtual host file.



       <IfModule mod_fastcgi.c>
      AddHandler php7-fcgi-privatebin .php
      Action php7-fcgi-privatebin /php7-fcgi-privatebin
      Alias /php7-fcgi-privatebin /usr/lib/cgi-bin/php7-fcgi-privatebin
      FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi-privatebin -socket /run/php/php7.0-fpm.privatebin.sock -pass-header Authorization
      <Directory "/usr/lib/cgi-bin">
      Require all granted
      </Directory>
      </IfModule>

      <Directory /var/www/bin.xxxx.io/html>
      Options +SymLinksIfOwnerMatch
      AllowOverride None

      Require all granted
      RewriteEngine On
      <IfModule mod_fastcgi.c>
      <FilesMatch ".+.ph(p[3457]?|t|tml)$">
      SetHandler php7-fcgi-privatebin
      </FilesMatch>
      </IfModule>
      </Directory>


      The pooled user appears to be working.



      #$ps aux | grep php
      private+ 1532 0.0 0.1 717056 22780 ? S 11:22 0:00 php-fpm: pool privatebin
      private+ 1533 0.0 0.1 717056 22780 ? S 11:22 0:00 php-fpm: pool privatebin
      www-data 1534 0.0 0.9 806716 149296 ? S 11:22 0:05 php-fpm: pool www
      www-data 1539 0.0 0.9 1041968 150420 ? S 11:22 0:03 php-fpm: pool www
      www-data 2299 0.0 0.8 1039040 144136 ? S 12:25 0:02 php-fpm: pool www


      Finally... here are the file permissions.



      /var/www/html
      dr-xr-x--- 2 root www-data 4096 Apr 2 11:20 cfg/
      dr-xr-x--- 4 root www-data 4096 Aug 11 2018 css/
      drwxr-x--- 2 privatebin www-data 4096 Apr 2 13:04 data/
      dr-xr-x--- 2 root www-data 4096 Aug 11 2018 i18n/
      dr-xr-x--- 2 root www-data 4096 Aug 11 2018 img/

      /var/www/html/data
      -rw-r----- 1 privatebin www-data 19 Apr 2 13:04 .htaccess
      -rwxrw---- 1 privatebin www-data 45 Apr 2 13:26 purge_limiter.php*
      -rwxrw---- 1 privatebin www-data 522 Apr 2 06:57 salt.php*
      -rwxrw---- 1 privatebin www-data 130 Apr 2 13:26 traffic_limiter.php*


      As I said, this appears to be working, but I had to fiddle with the user permission to get them right. An advise is greatly appreciated.










      share|improve this question







      New contributor




      Eddie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.












      After some fooling around with PHP-FPM user pools, I got a configuration that works... but is right?



      I'm self hosting a PrivateBin. Obviously, I'm trying to get this install as secure as possible but this is my first time setting up PHP-FPM user pools.



      Following these instructions I setup the permissions. My concern is that this app won't run without write and execute privileges to the traffic_limiter.php file located in the data directory. This obviously concerns me.



      User Configuration
      I created a user called privatebin and also created the appropriate pool in /etc/php/7.2/fpm/pool.d/privatebin.conf.



      [privatebin]
      user = privatebin
      group = privatebin
      listen = /run/php/php7.0-fpm.privatebin.sock
      listen.owner = privatebin
      listen.group = www-data
      listen.mode = 0660

      pm = dynamic
      pm.max_children = 5
      pm.start_servers = 2
      pm.min_spare_servers = 1
      pm.max_spare_servers = 3


      I also added the following to the virtual host file.



       <IfModule mod_fastcgi.c>
      AddHandler php7-fcgi-privatebin .php
      Action php7-fcgi-privatebin /php7-fcgi-privatebin
      Alias /php7-fcgi-privatebin /usr/lib/cgi-bin/php7-fcgi-privatebin
      FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi-privatebin -socket /run/php/php7.0-fpm.privatebin.sock -pass-header Authorization
      <Directory "/usr/lib/cgi-bin">
      Require all granted
      </Directory>
      </IfModule>

      <Directory /var/www/bin.xxxx.io/html>
      Options +SymLinksIfOwnerMatch
      AllowOverride None

      Require all granted
      RewriteEngine On
      <IfModule mod_fastcgi.c>
      <FilesMatch ".+.ph(p[3457]?|t|tml)$">
      SetHandler php7-fcgi-privatebin
      </FilesMatch>
      </IfModule>
      </Directory>


      The pooled user appears to be working.



      #$ps aux | grep php
      private+ 1532 0.0 0.1 717056 22780 ? S 11:22 0:00 php-fpm: pool privatebin
      private+ 1533 0.0 0.1 717056 22780 ? S 11:22 0:00 php-fpm: pool privatebin
      www-data 1534 0.0 0.9 806716 149296 ? S 11:22 0:05 php-fpm: pool www
      www-data 1539 0.0 0.9 1041968 150420 ? S 11:22 0:03 php-fpm: pool www
      www-data 2299 0.0 0.8 1039040 144136 ? S 12:25 0:02 php-fpm: pool www


      Finally... here are the file permissions.



      /var/www/html
      dr-xr-x--- 2 root www-data 4096 Apr 2 11:20 cfg/
      dr-xr-x--- 4 root www-data 4096 Aug 11 2018 css/
      drwxr-x--- 2 privatebin www-data 4096 Apr 2 13:04 data/
      dr-xr-x--- 2 root www-data 4096 Aug 11 2018 i18n/
      dr-xr-x--- 2 root www-data 4096 Aug 11 2018 img/

      /var/www/html/data
      -rw-r----- 1 privatebin www-data 19 Apr 2 13:04 .htaccess
      -rwxrw---- 1 privatebin www-data 45 Apr 2 13:26 purge_limiter.php*
      -rwxrw---- 1 privatebin www-data 522 Apr 2 06:57 salt.php*
      -rwxrw---- 1 privatebin www-data 130 Apr 2 13:26 traffic_limiter.php*


      As I said, this appears to be working, but I had to fiddle with the user permission to get them right. An advise is greatly appreciated.







      apache-2.4 virtualhost php-fpm vps file-permissions






      share|improve this question







      New contributor




      Eddie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      Eddie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      Eddie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Apr 2 at 23:08









      EddieEddie

      11




      11




      New contributor




      Eddie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Eddie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Eddie is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          0






          active

          oldest

          votes












          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "2"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );






          Eddie is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f961205%2ffirst-time-setting-up-php-fpm-user-pool-is-this-config-a-security-risk%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          Eddie is a new contributor. Be nice, and check out our Code of Conduct.









          draft saved

          draft discarded


















          Eddie is a new contributor. Be nice, and check out our Code of Conduct.












          Eddie is a new contributor. Be nice, and check out our Code of Conduct.











          Eddie is a new contributor. Be nice, and check out our Code of Conduct.














          Thanks for contributing an answer to Server Fault!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f961205%2ffirst-time-setting-up-php-fpm-user-pool-is-this-config-a-security-risk%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

          Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

          What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company