MultiformeIngegno

  • Posts: 1,337
Re: Help with apache2
« Reply #45, on June 4th, 2012, 12:29 AM »
D'oh.. so if I understood correctly I should create a new group. Add the FTP user I created to that group and the root user too. Then I should set this group as owner of the only dirs I'd like to be accessible by the FTP user. The rest should be owned by root. Correct? :)

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Help with apache2
« Reply #46, on June 4th, 2012, 12:33 AM »
*shrug* I have no idea what you're actually trying to achieve and from where I'm (drunkenly) sat, it looks like it's more complicated than it should be...
When we unite against a common enemy that attacks our ethos, it nurtures group solidarity. Trolls are sensational, yes, but we keep everyone honest. | Game Memorial

MultiformeIngegno

  • Posts: 1,337
Re: Help with apache2
« Reply #47, on June 4th, 2012, 12:41 AM »
eheh :lol:
All my /home/www subdirs (so also /cache, /attachments, etc) have 'root' as group and 'ftp_user' as owner (at least this is what WinSCP is telling me). I did this to be sure that the ftp user could only access /home/www and not also the other directories.

Anyway the problem is (as you said) that owner of apache is root..
Re: Help with apache2
« Reply #48, on June 4th, 2012, 03:49 PM »
Another question ( :whistle: ): I have phpmyadmin installed. For every website I host on my VPS (thanks to virtual hosts) I noticed I can access phpmyadmin simply going to website.tld/phpmyadmin.
I'd like to avoid this.. is there a way to only have hostname/phpmyadmin accessible (and not for every website)..?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278

MultiformeIngegno

  • Posts: 1,337
Re: Help with apache2
« Reply #50, on June 4th, 2012, 04:27 PM »
Quote from Arantor on June 4th, 2012, 04:16 PM
How is it installed?
Uhm.. I think I just did apt-get install phpmyadmin.. it's in /etc/phpmyadmin
Here's apache.conf:
Code: [Select]
# phpMyAdmin default Apache configuration

Alias /phpmyadmin /usr/share/phpmyadmin

<Directory /usr/share/phpmyadmin>
Options FollowSymLinks
DirectoryIndex index.php

<IfModule mod_php5.c>
AddType application/x-httpd-php .php

php_flag magic_quotes_gpc Off
php_flag track_vars On
php_flag register_globals Off
php_admin_flag allow_url_fopen Off
php_value include_path .
php_admin_value upload_tmp_dir /var/lib/phpmyadmin/tmp
php_admin_value open_basedir /usr/share/phpmyadmin/:/etc/phpmyadmin/:/var/lib/phpmyadmin/
</IfModule>

</Directory>

# Authorize for setup
<Directory /usr/share/phpmyadmin/setup>
    <IfModule mod_authn_file.c>
    AuthType Basic
    AuthName "phpMyAdmin Setup"
    AuthUserFile /etc/phpmyadmin/htpasswd.setup
    </IfModule>
    Require valid-user
</Directory>

# Disallow web access to directories that don't need it
<Directory /usr/share/phpmyadmin/libraries>
    Order Deny,Allow
    Deny from All
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib>
    Order Deny,Allow
    Deny from All
</Directory>

Maybe changing the line Alias /phpmyadmin /usr/share/phpmyadmin ..?

Arantor

  • As powerful as possible, as complex as necessary.
  • Posts: 14,278
Re: Help with apache2
« Reply #51, on June 4th, 2012, 04:33 PM »
Yeah, that's the problem, it's being declared as an Alias, which means it's applicable to all virtual hosts. Normally for virtual hosting that's fine.

What I personally do, should I ever install pMA on a server is install it into a given folder and dump the rest of the stuff into an .htaccess file so it's contained in the one place - I don't use apt-get for that, though.

I don't know what you should do for the best, though.

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
Re: Help with apache2
« Reply #52, on June 4th, 2012, 04:35 PM »
Quick fix would be to move the Alias to VHost declaration.
The way it's meant to be

MultiformeIngegno

  • Posts: 1,337
Re: Help with apache2
« Reply #53, on June 4th, 2012, 05:00 PM »
Quote from Dragooon on June 4th, 2012, 04:35 PM
Quick fix would be to move the Alias to VHost declaration.
You mean adding the line 'Alias /phpmyadmin /usr/share/phpmyadmin' to the 'default' site and removing that line from phpmyadmin's apache.conf?

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
Re: Help with apache2
« Reply #54, on June 4th, 2012, 05:38 PM »
Quote from MultiformeIngegno on June 4th, 2012, 05:00 PM
Quote from Dragooon on June 4th, 2012, 04:35 PM
Quick fix would be to move the Alias to VHost declaration.
You mean adding the line 'Alias /phpmyadmin /usr/share/phpmyadmin' to the 'default' site and removing that line from phpmyadmin's apache.conf?
Yeah.

MultiformeIngegno

  • Posts: 1,337
Re: Help with apache2
« Reply #56, on June 5th, 2012, 08:43 PM »
I restarted the server and now I'm getting this mail every 10 min ~:
Subject:
Cron <smmsp@ts100561> test -x /etc/init.d/sendmail && /usr/share/sendmail/sendmail cron-msp

Text:
/usr/share/sendmail/sendmail: 899: /usr/share/sendmail/sendmail: /usr/sbin/sendmail-msp: not found

Dragooon

  • I can code! Really!
  • polygon.com has to be one of the best sites I've seen recently.
  • Posts: 1,841
Re: Help with apache2
« Reply #57, on June 6th, 2012, 05:44 PM »Last edited on June 6th, 2012, 05:52 PM
In reply to your thought, using mod_php + apache2 in a low-memory situation is a very bad idea. Because on every new request apache forks a new child process and each child process with mod_php in SMF's case takes about 25-60 MB of RAM. And apache does this without any regards of how much of RAM is left. So I can hold F5 on any one of your site and crash your server without much trouble. Solution to this is using PHP-FPM which spawns semi-persistent processes and manages the low RAM scenarios much better. What PHP-FPM does is that it separates the php process into a separate entity instead if being bound into apache, so apache doesn't have to load php on every request even if it's non-php related. This itself saves RAM, plus FPM can restrict the number of open processes thus preventing RAM overflow. FCGI is an interface to use PHP-FPM with Apache2. I used this guide to install FCGI + PHP-FPM on an Ubuntu 12.04 server, this should be fine.

PS : I'm fairly sure what I said here is correct, but I can be wrong. Feel free to correct me in the most humiliating way possible.

EDIT: As a matter of fact, Baidu can single handily take out a website with mod_php in a low RAM situation.

ziycon

  • Posts: 126
Re: Help with apache2
« Reply #58, on June 6th, 2012, 05:45 PM »
Quote from MultiformeIngegno on June 5th, 2012, 08:43 PM
I restarted the server and now I'm getting this mail every 10 min ~:
Subject:
Cron <smmsp@ts100561> test -x /etc/init.d/sendmail && /usr/share/sendmail/sendmail cron-msp

Text:
/usr/share/sendmail/sendmail: 899: /usr/share/sendmail/sendmail: /usr/sbin/sendmail-msp: not found
I've experienced a similar issue before with POSTFIX. It turned out that apt did not remove the old sendmail files (just the sendmail-bin). To fix this I did the below:
Code: [Select]
sudo apt-get --purge remove sendmail-base sendmail-cf sendmail-doc

This removed any leftover files form the old sendmail install (including /etc/cron.d/sendmail which causes this error message).
APRAI - Custom Theme - SMF 2.0.5


MultiformeIngegno

  • Posts: 1,337
Re: Help with apache2
« Reply #59, on June 6th, 2012, 09:17 PM »Last edited on June 6th, 2012, 09:31 PM
Quote from Dragooon on June 6th, 2012, 05:44 PM
I used this guide to install FCGI + PHP-FPM on an Ubuntu 12.04 server, this should be fine.
Uhm, I think I'm doing something wrong with the latest thing (adding the lines to your virtualhost section)..
I'm trying with the website heystella.it (located in /home/www/heystella.it/htdocs), here's my site Vhost with the lines added:

Code: [Select]
<VirtualHost *:80>
        ServerAdmin xxxx@xxx.com
        ServerName  heystella.it
        ServerAlias [url=http://www.heystella.it][url=http://www.heystella.it]www.heystella.it[/url][/url]

        # Indexes + Directory Root.
        DirectoryIndex index.html index.cgi index.pl index.php index.xhtml
        DocumentRoot /home/www/heystella.it/htdocs/

        # CGI Directory
        ScriptAlias /cgi-bin/ /home/www/heystella.it/cgi-bin/
        <Location /cgi-bin>
                Options +ExecCGI
        </Location>


        # Logfiles
        ErrorLog  /home/www/heystella.it/logs/error.log
        CustomLog /home/www/heystella.it/logs/access.log combined

        FastCgiExternalServer /home/www/php5.external -host 127.0.0.1:9000
        AddHandler php5-fcgi .php
        Action php5-fcgi /usr/lib/cgi-bin/php5.external
        Alias /usr/lib/cgi-bin/ /home/www/
</VirtualHost>

But if I visit the website I get:

Not Found

The requested URL /usr/lib/cgi-bin/php5.external/index.php was not found on this server.


EDIT: Don't know why now it seems to work... http://heystella.it/test.php