php
Well, this is easy...
Well, this is easy...
- Install webserver, sqlite, php5
aptitude install lighttpd php5-cgi php5-cli php5-sqlite - Or if you want mysql:
aptitude install lighttpd mysql-server mysql-client php5-cgi
There is a chance you might need php5.3 so look here
Ftp server - To edit the vsftpd server.
nano /etc/vsftpd.conf (info on default directory here)
Lighttpd- Lighttpd's default document root is /var/www on Debian, and the configuration file is /etc/lighttpd/lighttpd.conf. (From there you can change your Document root to be somewhere else and not /var/www).
Additional configurations are stored in files in the /etc/lighttpd/conf-available directory - these configurations can be enabled with the lighttpd-enable-mod command which creates a symlink from the /etc/lighttpd/conf-enabled directory to the appropriate configuration file in /etc/lighttpd/conf-available. You can disable configurations with the lighttpd-disable-mod command.
Php in lighttpd - nano /etc/php5/cgi/php.ini and edit
cgi.fix_pathinfo=1 - To enable the fastcgi configuration (which is stored in /etc/lighttpd/conf-available/10-fastcgi.conf), run the following command:
lighttpd-enable-mod fastcgi
lighttpd-enable-mod fastcgi-phpThis creates a symlink /etc/lighttpd/conf-enabled/10-fastcgi.conf which points to /etc/lighttpd/conf-available/10-fastcgi.conf:
ls -l /etc/lighttpd/conf-enabled - Then we reload Lighttpd:
/etc/init.d/lighttpd force-reload - nano /var/www/info.php
and edit the file to include only this line
<?php phpinfo(); ?> - Now go to your browser and enter http://<NAS'I.P.>/info.php
In case you get 403 forbidden then issue chmod 644 /var/www/info.php
Don't forget to change rights.
groupadd lighttpd
useradd -g lighttpd -d /var/www/html -s /sbin/nologin lighttpd
mkdir /var/log/lighttpd
chown lighttpd:lighttpd /var/log/lighttpd
chown -R lighttpd:lighttpd /var/www - To create a php startup page that connects to the php5-sqlite just add this code to the start
- <?php
if ($db = sqlite_open('my_sqlite_db', 0666, $sqlite_error)) { }
else { die ($sqlite_error); }
?> - The first parameter of sqlite_open() is the name of the database you want to open. You can think of this as the database name in MySQL, except that if the database does not exist, it will be created for you. The database will be created in the same directory as the PHP file that calls the function. If this file is in a path that is accessible to anyone, they will be able to access your database and to view the contents of it. Obviously, this is a major security risk. To remedy this, you need to enter a relative path out of the web root, such as:
sqlite_open(' ../../../database_name ', 0666, $sqlite_error) - So to retrieve info from a query all you need to do is <?php
if ($db = sqlite_open('../../../my_sqlite_db', 0666, $sqlite_error))
{
$result = sqlite_query($db, 'SELECT name FROM test');
while ($row = sqlite_fetch_array($result))
{ echo 'Name: '.$row['name'].'<br />'; }
}
else { die ($sqlite_error); }
?>
hi, i have a seagate business storage 2-bay 220, i wish i could make a web server, but i dont know how to do it. Im trying to figure out how you telling to do on this page, but i cant understand how to and where to write these commands. Can you please help me out? - please send me a mail: mudiii@gmail.com
ReplyDeleteHello, you need to start by the 1st part.
DeleteI don't think you can install a modded linux in your business storage unit.
Hi, thanks for the quick reply. I have been searching the net for 5 hours now. And i have decided to stop doing that. The NAS i have is a business storage 2 bay, and there are only guides to mod the black armor 220/110 NAS. I have to use a .img file and the .md5 file i order to "update", and access ssh. It could be great if i could run debian / webserver from the NAS, but it does not seem to be so easy :D
DeleteAnyway i would like to thank you very much for the guide / info.
Hi, i have SSH access now to the NAS server, im in really need to know how i can install debian on it - maybe dropbear?
ReplyDeletePlease can you help me? i also have access to the .img files - is it possible to install debian through SSH??
i can access the whole root and insert files/delete. - Just want to make it work with a debian. - any help will be appreciated !