Skip to content

Instantly share code, notes, and snippets.

@Mouad-BGD
Created June 4, 2012 19:09
Show Gist options
  • Select an option

  • Save Mouad-BGD/2870226 to your computer and use it in GitHub Desktop.

Select an option

Save Mouad-BGD/2870226 to your computer and use it in GitHub Desktop.
Drupal instalation
if u have rewrite module installed : check by apachectl -M or apache2ctl -M
then check if the .htaccess is enabled (by default default is disabled)
to enable it go /etc/httpd/conf/httpd.conf and change:
<Directory />
Options FollowSymLinks
AllowOverride None /* change None to All */
to
<Directory />
Options FollowSymLinks
AllowOverride All
Missing files directory.
sites/default/files
fix
mkdir sites/default/files
chmod a+w sites/default/files
Missing setting.php
sites/default/settings.php
fix
cp sites/default/default.settings.php sites/default/settings.php
chmod a+w sites/default/settings.php
chmod go-w sites/default/settings.php after the instalation is done
open the http/https outgoing connection
iptables -L /* return all the rules */
netstat -ltn /* list the listening services you are running, If you see 127.0.0.1:2194 then you are listening only on local connections*/
Allow incoming http/web traffic at port 80
iptables -A INPUT -i eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT
Outgoing
iptables -A OUTPUT -o eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT
general
SERVER_IP="202.54.10.20"
iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d $SERVER_IP --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s $SERVER_IP --sport 80 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
dport--> destination port
sport--> source port
s -->source
d -->destination
Allow incoming https/secure web traffic at port 443
SERVER_IP="202.54.10.20"
iptables -A INPUT -p tcp -s 0/0 --sport 1024:65535 -d $SERVER_IP --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p tcp -s $SERVER_IP --sport 443 -d 0/0 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
Allow outgoing http/web service traffic to port 80
SERVER_IP="202.54.10.20"
iptables -A OUTPUT -p tcp -s $SERVER_IP --sport 1024:65535 -d 0/0 --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 --sport 80 -d $SERVER_IP --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT
Allow outgoing https/secure web service traffic to port 443
SERVER_IP="202.54.10.20"
iptables -A OUTPUT -p tcp -s $SERVER_IP --sport 1024:65535 -d 0/0 --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 --sport 443 -d $SERVER_IP --dport 1024:65535 -m state --state EST
To allow outgoing connections from server1 to server 2 on TCP port 2194, use this on server1:
iptables -A OUTPUT -p tcp -d <server2ip> --dport 2194 -j ACCEPT
To allow incoming connections from server1 to server2 on TCP port 2194, use this on server2:
iptables -A INPUT -p tcp -s <server1ip> --dport 2194 -j ACCEPT
-----------------------------------------------------------------------------------------------------------------------------
Hi, guys, I usually get this error (even on D6) if server (particular website) can not resolve to itself. Especially, if web server is behind the NAT, and Provider do not support full Split DNS functionality. Including some quirks in firewall settings. If you have possibility, please add your www.site.com to server's local /etc/hosts file, using servers internal (if such) IP address. Or please ask your provider to do this.
E.g.:
192.168.1.100 www.site.com site.com
This solves situation. Although post is more than one year old, I'm posting this for somebody else to get solution.
to enable installing modules and themes:
1- chmod a+w for sites/all/modules and sites/all/themes
2- yum install vsftp
3- edit SElinux setsebool -P ftp_home_dir 1
4- set up the vsftp see instruction in my gist
I have been fighting this problem several times, without success.
Now I have been able to pin down the problem.
The wanted behaviour is:
You paste the url of the module or theme you want to install
You click install
Your module or theme gets installed
What I have seen on several installations, and this is what you don't want:
You paste the url of the module or theme you want to install
You click install
It asks for some FTP (or SSH) credentials. WTF??????
To avoid this, make sure the folder /sites/default is OWNED by the user that executes the drupal scripts. On most Ubuntu installations, this is the apache user: www-data.
Don't ask me why this works. I don't know if this is intended or not. It doesn't make so much sense to me, but there might be an explanation. For me it would be OK that the temporary directory is writable by the apache user and the themes or modules folder is writable as well.
So this should do the trick when the user is www-data:
chown www-data sites/default
I hope this works. Please let me know.
write and read
--------------
to allow drupal to write and read files in drupal directory u have to label it:
chcon -R -t httpd_user_rw_content_t /path/to/drupal/dir
more info about labeling see: vhost errors--> selinux section in my gist.rep
network connect to database
---------------------------
setsebool -P httpd_can_network_connect 1 /* enable httpd script to connect the network like drupal upade */
optional
--------
setsebool -P allow_ypbind 1
setsebool -P httpd_can_network_relay 1
more info:
http://linux.die.net/man/8/httpd_selinux
http://wiki.centos.org/TipsAndTricks/SelinuxBooleans
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment