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

          How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

          What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

          Why did Thanos need his ship to help him in the battle scene?Which actor plays Thanos in the Avengers mid-credits scene?Are there economic implications portrayed in comics where the buildings and cities are ruined almost daily?Old X-Men comic where team travels to alien world with a ring-like sun that needs recharging?Why does Ego need help sleeping?Is there an objective answer to who “the strongest Avenger” is?How did Banner get unstuck?Why did Thanos get hit?How did Thanos (or anyone) know the Infinity Stones would give him this power?Did Thanos leave Eitri alive for his after-sales service?In Avengers 1, why does Thanos need Loki?