Jump to content

Nginx+PHP-FPM secure server installation guide

Featured Replies

well, I think I was resolved by myself :smile:

Thank you for your support

P/S: you reply so fast. Can't believe it o.0

  • Replies 71
  • Views 4.6k
  • Created
  • Last Reply
  • Author

Glad to hear it!

No problem, and I get that all the time, I guess I just don't really have a life :P

  • 2 weeks later...

So I have this bizarre issue.......

After rebooting, my /var/run/php-fpm folder is missing and I have to recreate it again, then restart php-fpm.

Running Debian Wheezy, this has me lost, and is prolly very simple, any idea's?

  • Author

Debian Wheezy now mounts /var/run as a tmpfs by default. (/var/run is actually just symlinked to /run now, which is a tmpfs)

To prevent the php-fpm directory from being lost after reboot, you'll need to modify the php-fpm init script.

(Make sure you've followed the directions here first: http://community.invisionpower.com/index.php?app=forums&module=forums&section=findpost&pid=2404669)

Open /etc/init.d/php-fpm in your favorite text editor and add this to it,

# Replace php-fpm directory that may be lost on reboot
test -e /var/run/php-fpm || install -m 755 -o php-fpm -g root -d /var/run/php-fpm

The final output should look like this:

Reveal hidden contents

  • Author

Nope, never heard of it. Looks interesting though. I've considered writing my own management scripts for handling NSD zones and basic Nginx configurations, but I haven't gotten around to playing with the idea yet. Right now I just manage most everything by hand.

me too. First time I hear about it was on xF website but I'm waiting for someone to give it a try :)

  • Author

Recently I've been preoccupied playing with CodeIgniter for some pet projects of mine.

It's a really beautiful and fun PHP framework, a friend recently suggested it to me and I've been addicted since. I've never actually used any PHP framework before, so it's a fun first experience.

I feel like this and {wrap}bootstrap has spoiled me. It takes almost all of the painful tediousness out of programming, heh :tongue:

  Quote

Debian Wheezy now mounts /var/run as a tmpfs by default. (/var/run is actually just symlinked to /run now, which is a tmpfs)

To prevent the php-fpm directory from being lost after reboot, you'll need to modify the php-fpm init script.

(Make sure you've followed the directions here first: http://community.invisionpower.com/index.php?app=forums&module=forums&section=findpost&pid=2404669)

Open /etc/init.d/php-fpm in your favorite text editor and add this to it,

# Replace php-fpm directory that may be lost on reboot
test -e /var/run/php-fpm || install -m 755 -o php-fpm -g root -d /var/run/php-fpm

The final output should look like this:

<SNIP> STUPID EDITOR BUG AGAIN!

Perfect :smile:

I figured that it had something to do with it being tmpfs, but could not figure out what was going on, maybe next time I will sleep on it first.

Once again thanks Kirito :thumbsup:

  Quote

IPB works fine on Centmin Mod see examples at http://centminmod.com/nginx_configure.html including IPB setup example :smile:

cool! Now all I need is a tutorial on adding ModSecurity to it

  • 2 weeks later...

Hello Kirito !

I have a new question. I hope you can help :D

I'm using nginx as reverse proxy for apache. But number of online user (in 15 minutes) show on my board stat decrease to very low. I usualy have 100-150 user online (show on board stat), but when switch to nginx my board stat just show about 10-20, so strange

Here is my nginx config

server {
	listen 80;
	server_name www.domain.com domain.com;
	
        location / {
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

                proxy_pass              http://IP_SERVER:8080;
				client_max_body_size       16m;
				client_body_buffer_size    128k;
				proxy_buffering     on;  

				proxy_connect_timeout      90;
				proxy_send_timeout         90;
				proxy_read_timeout         120;
				proxy_buffer_size          8k;
				proxy_buffers              32 32k;
				proxy_busy_buffers_size    64k;
				proxy_temp_file_write_size 64k;
				error_page              502 503 /usr/share/nginx/html/50x.html;
				
        }
        #static files
        location ~* ^.+.(nrg|htm|html|jpg|jpeg|gif|png|ico|css|zip|7z|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js|avi|mp3|mp4|mpg|iso|djvu|dmg|flac|r70|mdf|chm|sisx|sis|flv|thm|bin)$ {

           root /path/to/public_html;
        }
I don't know why. Please help me
  • 3 weeks later...

Just a note to everyone browsing this thread and that needs support, the OP says that he's leaving this community and can no longer make any posts. I guess he was banned. No alternate forms of contact were provided.

The OP?

The topic creator.

  • 3 weeks later...

damn that sucks

due to getting hit with ton of bills jad to dump the 48gb dual xeon and move to a 2gb vps so am setting this up now.

heck of a way to force me into cmd line running LOL

was about to ask how people used phpmyadmin in this setup, if used as a sub or not (on cent os 6.4) since there is no sites-enabled directory most instructions mention.

not sure what you are asking about Dmacleo, but once i made the wrong setup which made phpmyadmin only work if you specify index.php, if you dont it will give a forbbiden error, which i like :)

how to set up nginx config f we have forum on /forum/ folder and would like have ip.content on main folder?

just now it's like that:

 location / {
        index  index.php index.html index.htm;


        if (!-e $request_filename) {
            rewrite . /forum/index.php last;
        }
    }

  Quote

not sure what you are asking about Dmacleo, but once i made the wrong setup which made phpmyadmin only work if you specify index.php, if you dont it will give a forbbiden error, which i like :smile:

I just ran it as a subdomain and it seems to work.

trying to learn how to add email address/webmail to setup like this.

SO used to using an interface and having ability to add email accounts to the domain in question, huge learning curve for me.

getting there though, site seems to be ok and apc running around 99.2% hit rate.

seems I first have to manually add a user then manually add email acct. just reading up how to make sure they use correct domain.tld

learning curve.

as far as getting site up, followed this tutorial and was running in 20 minutes, is a good tutorial.

learning as I go :)

have multiple sites (3) running following this guide (just change socket name in fpmm config) and no issues with Phpmyadmin/squirrelmail/roundcube.

since running a few I am considering using the /home/ directory method but thats just a simple path change in config.

this tutorial allowed me to have stuff running in 20 minutes, should be a sticky post.

very useful info.

I did enable remi repo and mariadb to use that and I manually compiled nginx 1.5.1 but that was simple to do also.

  Quote

Just a note to everyone browsing this thread and that needs support, the OP says that he's leaving this community and can no longer make any posts. I guess he was banned. No alternate forms of contact were provided.

why what happened?

  Quote


why what happened?

Drama I guess.

Archived

This topic is now archived and is closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.