[Ask] Server Build Advice

andych

Well-Known Member
#1
Hi,

I would like to build a new server focused to host single domain only with LiteSpeed + MySQL.

1. What Operating System is the best for LSWS? I'm considering about Debian 7 or FreeBSD.

2. What File System ia the best for hosting PHP File with some static files? I'm considering about EXT4 or XFS.

3. Can we uae MariaDB with LSWS?

4. What is LSWS' default public_html path?

Any advice would be appreciated. Thank you!
 

NiteWave

Administrator
#4
>1. What Operating System is the best for LSWS? I'm considering about Debian 7 or FreeBSD.
Debian. however Redhat or CentOS may be better than Debian

>2. What File System ia the best for hosting PHP File with some static files? I'm considering about EXT4 or XFS.
I believe no difference between them in practice for a single server.
for big traffic, 1G NIC should be bottle-neck far before File System(disk i/o) becomes bottle-neck.

>3. Can we use MariaDB with LSWS?
no problem, at all.

>4. What is LSWS' default public_html path?
no such default. it's 100% set by user in configuration file.

>5. What is the best file system for SQL? Is it EXT4 or XFS?
both are excellent for a small single server. similar answer with question 2.
 

andych

Well-Known Member
#5
@NiteWave:

Thank you for your reply.

I've successfully installed LSWS on Debian minimal install with the following PHP build:

Code:
'--with-mysql' '--with-mysqli' '--with-mysql-sock=/var/lib/mysql/mysql.sock' '--with-zlib' '--with-gd' '--enable-shmop' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' '--enable-sysvshm' '--enable-mbstring' '--with-iconv' '--with-libdir=lib64' '--with-litespeed' '--with-curl' '--enable-zip' '--with-bz2' '--with-jpeg-dir=lib64' '--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-gd-native-ttf' '--enable-exif' '--with-openssl' '--with-xmlrpc' '--with-freetype-dir=lib64' '--with-png-dir=lib64' '--enable-inline-optimization' '--enable-xml'
But my PHP app cannot send direct mail, any idea how to fix this?
 

andych

Well-Known Member
#7
you can create a simple test.php to ensure if mail works or not
e.g.,
http://php.net/manual/en/function.mail.php
Example #1 Sending mail
Hi, I just tested and I got this on /var/log/exim4/mainlog:
Code:
2015-01-03 16:32:57 1Y7L4r-0001Bk-HW <= testmail@from-php.scri.pt U=nobody P=local S=442

2015-01-03 16:32:57 1Y7L4r-0001Bk-HW ** lolipop@gmail.com R=nonlocal: Mailing to remote domains not supported

2015-01-03 16:32:57 1Y7L4r-0001Bo-KJ <= <> R=1Y7L4r-0001Bk-HW U=Debian-exim P=local S=1289

2015-01-03 16:32:57 1Y7L4r-0001Bo-KJ ** testmail@from-php.scri.pt R=nonlocal: Mailing to remote domains not supported

2015-01-03 16:32:57 1Y7L4r-0001Bo-KJ Frozen (delivery error message)

2015-01-03 16:32:57 1Y7L4r-0001Bk-HW Completed
It's a brand new fresh installed Debian 7, any clue what's wrong with my exim?

And if I set LSWS to run as nobody:nogroup then should I set nobody:nogroup too for all of my public_html? or lsadm:lsadm or I can set to any normal individual users? I need write permission on 777 chmodded directories though..
 

NiteWave

Administrator
#9
>It's a brand new fresh installed Debian 7, any clue what's wrong with my exim?
run test from linux command line first(before test in php), can it work ?

>And if I set LSWS to run as nobody:nogroup then should I set nobody:nogroup too for all of my public_html? or lsadm:lsadm or I can set to any normal individual users? I need write permission on 777 chmodded directories though..

ok to set to individual users. just ensure nobody:nogroup user can read these files. also ok to set directory's permission to 777

>And is it safe to set public_html -R chown to nobody:nogroup? while I have multiple vhosts.
set to individual user is safer as said above
 

andych

Well-Known Member
#10
@NiteWave: Thank you for your reply, I just set to individual user but having write issue, so I set to nobody:nobody, is it okay?

Exim only delivers locally, any idea how to set it deliver remote as well?
 

NiteWave

Administrator
#11
should be nobody:nogroup instead of nobody:nobody on Debian ?

since you host single domain only, it should be ok to set public_html as nobody:nogroup and will able to write.

regarding Exim, have no much experience with it. usually it just works.
 

redstrike

Well-Known Member
#12
5. What is the best file system for SQL? Is it EXT4 or XFS?
2. What File System ia the best for hosting PHP File with some static files? I'm considering about EXT4 or XFS.
You should read this whitepaper from RedHat to choose between EXT4 and XFS:

How to Choose your Red Hat Enterprise Linux Filesystem
http://www.redhat.com/f/pdf/RHEL6_FileSystem_WP_5677547_0311_dm_web.pdf

In short, XFS is more advanced than EXT4, which is the default filesystem on RedHat 7 / CentOS 7. But this doesn't mean EXT4 is not great for you, if you won't do any heavy computing on a very large dataset (i means a lot of TB++), EXT4 is the great one to go, because it's more efficient than XFS in term of consuming CPU cycles.

If you cannot understand my words (sr for bad writing skill ^^), you should read the whitepaper, it's not a very long one and really "eyes-friendly".
 

andych

Well-Known Member
#13
Hi @NiteWave, I just set the permission recursively to nobody:nogroup and now permission issue has been fixed.

Will this lead security issue if I have multiple users within the server?

Hi @redstrike, thank you for your clue man, it really helps and I really appreciate it!
 
#14
>I would like to build a new server focused to host single domain only with LiteSpeed + MySQL.
>Will this lead security issue if I have multiple users within the server?
you can
#chown -R user:usergroup public_html
but all files/directories under pubic_html should be readable by nobody:nogroup which litespeed process run as.
 

andych

Well-Known Member
#15
suddenly my LSWS got timed-out (if I open www)

then I tried to visit LSWS admin, I got: 503 service unavailable.

I checked on the terminal, is like this:

Code:
top - 17:13:17 up 20 days, 18:28,  1 user,  load average: 0.05, 0.03, 0.05
Tasks:  77 total,  1 running,  76 sleeping,  0 stopped,  0 zombie
%Cpu(s):  0.0 us,  0.2 sy,  0.0 ni, 99.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:  2061136 total,  1940904 used,  120232 free,  32164 buffers
KiB Swap:  1990652 total,  1295028 used,  695624 free,  45224 cached
Looks like out of memory, how to control memory usage?

the settings are still default.

root@www:/usr/local/lsws/logs#
Code:
2015-01-25 17:16:13.028 [ERROR] [www_lsphp]: Failed to start one instance.
2015-01-25 17:16:13.028 [INFO] [157.55.39.100:7143-0#www] connection to [uds://tmp/lshttpd/forum_lsphp.sock] on request #997, confirmed, 0, associated process: -1, running: 0, error: Cannot allocate memory!
2015-01-25 17:16:20.057 [ERROR] [www_lsphp]: Failed to start one instance.
2015-01-25 17:16:20.057 [INFO] [66.249.65.145:43415-0#www] connection to [uds://tmp/lshttpd/forum_lsphp.sock] on request #997, confirmed, 0, associated process: -1, running: 0, error: Cannot allocate memory!
---

Until somehow I managed to stop LSWS.

and this is what I found on the console:

 
Last edited:
#16
the workaround is to restart lsws. should fix it temporarily?

the root cause most likely at your php package -- forum script, you have to optimize it to consume less memory.
 

andych

Well-Known Member
#17
I restarted LSWS and now it's working, but that issue always happening from time to time.

forum script is just fine, never encountered this issue with apache though..

posible LSWS memory leak?
 
Top