TinyCore Nginx server with php-cgi and vsftpd

http://blog.matchgenius.com/tinycore-nginx-server-with-php-cgi-and-vsftpd/

 

Create fast testing server with TinyCore. I will be using Microcore (8MB) that resides in RAM and 500MB disk drive for persistence. TinyCore Nginx server with php-cgi and vsftpd can be used for for various testing purposes. My setup will be using another box for mysql. Assuming that you have TinyCore Microcore already installed on hard drive lets proceed to installing nginx. My Tiny Core is already installed and I can ssh to it from local machine.

#1: Install Nginx server

From terminal access application browser and search for nginx.

 

Select nginx.tcz and install. Press 2 then q and i to install. Along with Nginx other dependencies will be downloaded automatically: readline.tcz and pcre.tcz.

#2: Install php5

While you still inside application browser press s to search and type php5. Select php5.tcz and install. Installation will take a little longer because there are a lot more dependencies.

#3: Install vsftpd

Repeat the same installation process for vsftpd. s type vsftpd. Select vsftpd.tcz or if you want to use ssl version vsftpd-ssl.tcz and install.

#4: Copy configuration files

Copy default nginx.conf file to /usr/local/etc and edit it.

 

Copy mime.types to /usr/local/etc

 

Copy fastcgi_params to /usr/local/etc

 

Create symbolic link to libodbc.so.1 (In my case php-cgi fails to load without it)

 

 

Create nginx php-cgi startup script in /usr/local/etc/init.d/nginx . I modified my OpenSSH startup script like that:

 

 

#5: Edit nginx.conf

Edit /usr/local/etc/nginx.conf and make changes inside http{ server{ location / index index.php

 

On the bottom of the same file uncomment whats under pass the PHP scripts to FastCGI

 

#6: Edit vsftpd.conf

Configure /usr/local/etc/vsftpd.conf file. You can tweak it as you like and add more things but I will keep it basic for now. Make sure this settings are present.

 

 

#7: Create test index.php

Just so you can test your server lets create simple page to test if php is working.

 

 

 

 

#8: Tiny Core persistence save

All configuration will be lost if we reboot the server so lets make it persistent.
Edit /opt/.filetool.lst

 

 

 

 

Edit /opt/bootlocal.sh

 

 

 

 

Add auto bakup before server shutdown in /opt/shutdown.sh

 

 

 

 

Save your files to backup

 

 

Now you should be ready for reboot and test.

#9: TinyCore Nginx server test connect from outside

In my setup before I can connect to my TinyCore I have to add NAT in my firewall. Depending on your situation you may have to do it as well. Make sure nothing is blocking your connection. Because Im connecting through middle server that is OpenBSD im going to add NAT in my pf.conf file. Im going to open port 80 for Nginx and 20 and 21 for vsftpd.

 

 

Web server test:

 

FTP server test:

 

你可能感兴趣的:(server)