Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I found out NFS is the best way for Multi Server setup in Drupal File sharing
Can someone tell me how this works.
I have two Servers with Drupal Files connected to a common db in third Server
I have one more Server for files how shall I link this too both Drupal Servers using NFS and how NFS works?
when a user uploads the file from first drupal server does it make a copy in Shared Server or makes a
symbolic(soft) link in both drupal servers and adds the file in shared server?
Can someone please tell me and pass me a link to implement NFS for my MultiServer Drupal Setup.
Let us assume Server-A (ip: a.a.a.a) is the server where you are going to save the files, Server-B(ip: b.b.b.b) and Server-C (ip: c.c.c.c) will have drupal. In Server-A you may be storing the files in /store folder. This is to be mounted to folder /mnt/store in Server-B and Server-c.
For this you need to install nfs-kernal-server in Server-A and nfs-common and portmap on all three servers. NFS relies upon Remote Procedure Call(RPC) and portmap service is required to map RPC requests to the correct services.
In Server-A do these configurations:
sudo apt-get install nfs-kernel-server portmap nfs-common
sudo mkdir -p /mnt/nfstest
sudo chmod 777 /mnt/nfstest
sudo mount --bind /store /mnt/nfstest
sudo vi /etc/default/nfs-kernel-server in this file set NEED_SVCGSSD=no
sudo vi /etc/default/nfs-common in this file set: NEED_IDMAPD=yes and NEED_GSSD=no
sudo vi /etc/idmapd.conf in this file under [Mapping] set Nobody-User = nobody and Nobody-Group = nogroup
sudo vi /etc/hosts.deny add this: portmap mountd nfsd statd lockd rquotad : ALL
sudo vi /etc/hosts.allow add this: portmap mountd nfsd statd lockd rquotad : b.b.b.b, c.c.c.c {ipaddresses}
sudo vi /etc/exports add this: /mnt/nfstest b.b.b.b(rw,sync,no_subtree_check,fsid=0) and /mnt/nfstest c.c.c.c(rw,sync,no_subtree_check,fsid=0)
sudo exportfs -ra
sudo /etc/init.d/portmap restart
sudo /etc/init.d/nfs-kernel-server restart
In Server-B and Server-C do this
sudo apt-get install portmap nfs-common
sudo vi /etc/hosts.deny SET: `portmap : ALL`
sudo vi /etc/hosts.allow SET: portmap : a.a.a.a {Server-A's ipaddress}
sudo vi /etc/default/nfs-common SET: NEED_IDMAPD=yes and NEED_GSSD=no
sudo vi /etc/idmapd.conf under [Mapping] add Nobody-User = nobody and Nobody-Group = nogroup
modprobe nfs
mkdir /mnt/store
sudo mount -t nfs4 a.a.a.a:/ /mnt/store
Related
I am working on a Wordpress site. It works well, but when I enter a Wordpress page, it will be redirected to a new domain that has ec2 instance address as a part of it. I do not know why this happened? I have set up the correct domain name in Setting/General as well.
This website was built on an EC2 instance of AWS.
Thanks and look forward to hearing from you guys on this problem.
You should verify few things if they are correctly set :
Verify from wordpress admin dashboard if Settings >> General has correct domain. (You already did it).
Check wp-config.php if it has domain configured in it.
Check inside DB if the site url and home url are correctly set.
Check if you have .htaccess and if there is any code carrying domain name apart from wordpress default code.
If none of the above work I would suggest take dump of your database and search & replace the domain you are redirected to.
You can refer to link to verify few of the above :
http://www.inmotionhosting.com/support/website/wordpress/wordpress-changing-the-site-url-and-home-settings
Some database tables has that amazon's domain name. There can be two situations - fresh installation with no valuable posts and existing installation with posts.
Fresh installation with no valuable posts
For new installation, using a new database and running WordPress installer after deleting wp-config.php is easiest way if you have wp-config sample file. If wp-config sample file deleted then deleting the whole FTP root content and fresh wget to download WordPress, untar, then installation is practical.
Existing installation with posts
If that installation is existing with posts, you have to treat like changing domain name. There are WordPress plugins for it but SSH or PHPMyAdmin is reliable.
You need to run some MySQL queries from PHPMyAdmin or SSH to update the domain name like changing domain name or upgrading from HTTP to HTTTPS. Take a backup of that database first before running the commands :
UPDATE wp_options SET option_value = "http://www.new-domain.com" WHERE option_name = "siteurl";
UPDATE wp_posts SET guid = replace(guid, 'http://amazon-domain.com','http://new-domain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://amazon-domain.com', 'http://new-domain.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://amazon-domain.com','http://new-domain.com');
Long answer is written all over the earth for upgrading to HTTPS. Like this -- https://isabelcastillo.com/mysql-wordpress-http-to-https
Also add this to wp-config.php file :
define( 'WP_SITEURL', 'http://your-site.com' );
define( 'WP_HOME', 'http://your-site.com' );
For learning purpose, if you open that database SQL like text file, search that amazon's domain name in naked eye on text editor.
Create AWS account and create ec2 instance for same as follows:
-> select Linux AMI
->t2.micro
->security groups must be http,secure group and custom tcp (3306 for mysql)
->key generate(.pem file)
-> launch instances
on windows create .ppk file from pem using puttygen
login to your instance using putty
host - ec2-user#xxxxxxxxxxxxx
user - ec2-user
ssh(auth)-ppk file
connection ---> Success
after successful login perform these commands
>[ec2-user ~]$ sudo yum update -y
>sudo yum install -y httpd24 php70 mysql56-server php70-mysqlnd
>sudo service httpd start
>sudo chkconfig httpd on
>chkconfig --list httpd
>ls -l /var/www
> sudo usermod -a -G apache ec2-user
>sudo chown -R ec2-user:apache /var/www
>echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
>http://my.public.dns.amazonaws.com/phpinfo.php
>sudo yum list installed httpd24 php70 mysql56-server php70-mysqlnd
>rm /var/www/html/phpinfo.php
>sudo service mysqld start
>sudo mysql_secure_installation
>sudo service mysqld stop
>sudo chkconfig mysqld on
>sudo yum install php70-mbstring.x86_64 php70-zip.x86_64 -y
>cd /var/www/html
>wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.tar.gz
>tar -xvzf phpMyAdmin-latest-all-languages.tar.gz
>http://my.public.dns.amazonaws.com/phpMyAdmin
>chkconfig --list httpd
>sudo yum remove -y httpd24 php70 mysql56-server php70-mysqlnd perl-DBD-MySQL56
>sudo yum install -y httpd24 php56 mysql55-server php56-mysqlnd
>sudo yum remove -y httpd24 php56 mysql55-server php56-mysqlnd perl-DBD-MySQL55
>from localhost go to settings->site settings -> change site and home url
>export db(sql.zip)
>login to phpmyadmin
>import sql.zip here
>from your project folder upload your code to git or bitbucket
>now move to var/www/html
>sudo git pull origin master
> edit wp-config.php with your favorite text editor
(sudo nano wp-config.php)
>set values for db,db_name,db_host,db_user
(db host should be ip for your instance)
--Site is Live on host ip--
I'm using Ubuntu 16.04 and I want to run php files.
I installed Php 7 on it using:
sudo mkdir -p /var/www/html
sudo chown -R $USER:$USER /var/www/html
sudo apt install php
sudo apt install apache2
I created a php file (e.g. test.php) in /var/www/html. I can access it in the browser (e.g. http://localhost/test.php). Instead of executing the <?php ... ?> code, it is displayed as plain text:
I tried to turn short_open_tag to On. So I edited the /etc/php/7.0/fpm/php.ini and enabled it.
Then I ran sudo service php7.0-fpm restart. This didn't make any change in the browser. The php code is still displayed as plain text.
How can I fix this?
You didn't install apache properly, doing an apt-get on apache2 does not install everything.
what #newman stated is correct you can follow that guide, or here is a digitalocean link that is usuable for production server (since you would do this on a droplet). Note this is full stack LAMP, which I would assume you would get to eventually when you want to dab with mysql
https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-14-04
This is kind of a n00b question, but I'm a much better developer than a sys admin.
Im setting up an Amazon Linux instance on EC2 and can't seem to get php 5.5 with mcrypt installed. yum seems to throw php 5.3 at me each time i try to do a group install or just as a dependency of mcrypt.
Any suggestions? This is for a Laravel 4.1 application.
Thanks!
If you are using amazon linux, you will need to install the php packages that start with php55.
Older packages are kept for compatability.
Since start configuring an EC2 instance can be tricky and indeed there is not much available support or documentation at the date I'm writting this answer, I'll post the steps I followed that worked for me. So I hope it will be useful to someone else:
Start an EC2 instance as described on the AWS documentation. Do not use elastic beanstalk for deploying your php app.
Start you PuTTY session, it is well described on the AWS documentation.
When PuTTY session is on, install in the following order: apache server (v 2.4), php55, php55-mcrypt, php55-pdo and mysql55
sudo yum install httpd24
sudo yum install php55
sudo yum install php55-mcrypt
sudo yum install php55-pdo
sudo yum install mysql55
Check your server properly working sudo service httpd start. If succesfully installed, you'll see 'OK' and you should be able to see a sample page in the public DNS.
Add a group in order to allow "ec2-user" modifying and writing files inside var/www/html
sudo groupadd www
sudo usermod -a -G www ec2-user
Exit PuTTY and reenter again (so changes will be applied) exit
Reconnect and check membership
groups
Modify permissions on writing and editing files
sudo chown -R root:www /var/www
sudo chmod 2775 /var/www
find /var/www -type d -exec sudo chmod 2775 {} +
find /var/www -type f -exec sudo chmod 0664 {} +
Test your server
echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
sudo service httpd restart
visit http://publicdomain/phpinfo.php. If properly working (it should) it will display the php info page.
All these steps worked well for me after hours dealing with php versions that are not compatible with laravel 4.1>=
I was struggling with apache2 already installed in ubuntu so I decided to return back to lampp..I have unistalled apache 2 mysql server and phpmyadmin.
The problem is that when I type sudo which php
I get nothing...
So I cannot request e.g. sudo composer create-project laravel/laravel.....
since php is missing for root user..
Although when I type which php I get /opt/lampp/bin/php..
Is it possible to make the root user use the same path..?
You can do this:
Switch to root user
sudo su -
Edit the .bashrc
vi ~/.bashrc
And add a new path to the current one:
export PATH=$PATH:/opt/lampp/bin
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I am using ubuntu 12.04
When I am running my index file like"localhost/index.php" its working fine.
at the same time when I am running my script like "localhost/mypage/index.php" then it return a error called
You don't have permission to access /mypage/index.php on this server.
Apache/2.2.22 (Ubuntu) Server at localhost Port 80
Please help me to overcome the problem ../thanks
Assuming you have your files in /var/www and have installed the default stack that Ubuntu provides, the proper way is to add your user to the www-data group and then chown that folder. Open a terminal and type:
sudo useradd -g www-data myuser
sudo chown -R www-data /var/www/
Perhaps the web user doesn't have permission to access sub-directories? You can CHMOD/OWN to the user apache run's as?
Find out the user read this article: https://stackoverflow.com/questions/2509334/finding-out-what-user-apache-is-running-as
Using CHMOD:
sudo chmod -R /folder/path/
sudo chown -R _www_user:_www_group /folder/path