I uploaded my PHP(codeigniter) project on server. But when I run it I get below window
Index of /
Name Last modified Size Description
Apache Server at 'ip address here' Port 80
project folder is in /var/www/
DocumentRoot is set in projectName.conf directory as /var/www/projectName
Make sure your site .conf points to the public folder and not the site root.
<VirtualHost *:80>
ServerName site.co.uk
DocumentRoot /var/www/site.co.uk/public
<Directory "/var/www/site.co.uk/">
Options -Indexes +FollowSymLinks
Order allow,deny
Allow from all
AllowOverride FileInfo All
Require all granted
</Directory>
</VirtualHost>
You have to make sure about 3 points for this issue
Need .htaccess file in /var/www/projectName/.htaccess which is provided by Codeigniter
Must have rewrite module enabled.
If you are using Ubuntu OS and apache2 then execute sudo a2enmod rewrite in your terminal to enable this.
Must allow override URL by .htaccess rule in apache.conf for /var/www folder.
If you are using Ubuntu OS and apache2 then edit file /etc/apache2/apache.conf and change AllowOverride none to AllowOverride All in block/section of <directory /var/www> and then restart apache by sudo service apache2 restart command.
Related
I have Wordpress installed using an AWS EC2 instance. The public IP is as here. I used LetsEncrypt to get SSL, that worked fine. But after that, my homepage now shows the 'Apache2 Ubuntu Default Page'. It should be showing me the Wordpress homepage. I still have ssh access to the EC2 (Bitnami Wordpress), so my data is supposedly still there.
I've been doing some research at it seems that I need to change something with Apache so it direct to the Wordpress directory/page.
Any help in the matter would be most appreciated :)
Bitnami Engineer here,
It seems you installed the Apache2 system's service in the machine and it got started at boot time. The Bitnami apps don't use the system's services. That's why the Bitnami's Apache service can't be started because other service is already running in the 80 port. In order to stop and disable it, please run these commands
sudo service apache2 stop
sudo service apache2 disable
sudo /opt/bitnami/ctlscript.sh start apache
Happy to help!
The fact that you're getting the Apache default page is a good sign, it means everything from a networking standpoint is working correctly. Now, you just need to show Apache where to serve your files.
Apache stores their default configuration typically in /etc/httpd/httpd.conf or /etc/apache2/sites-available/default and looks something like below.
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
Before making changes to this file (whenever you find it), you will also need to know where the DocumentRoot is. This is essentially the directory that your index.php is located. In the example above it's located in /var/www, and that's typically a good place to start looking.
If you're having a hard time finding your root directory, you can do something like find / -type f -name "index.php".
Assuming your index.php is in /var/www/wordpress your configuration could look as simple as this.
<VirtualHost *:80>
ServerAdmin admin#example.com
ServerName example.com
ServerAlias www.example.com
DocumentRoot /var/www/wordpress
</VirtualHost>
I have created a virtual host for a drupal website on Windows 10 using Bitnami (WAMPstack),
and when start the website , i can access to the home page only but not to sub pages or sub-directories.
in the windows etc folder i did update the hosts file and added
127.0.0.1 website.local
also edited the httpd.conf enabled the virtual host
(Include conf/extra/httpd-vhosts.conf)
also edited the httpd-vhosts file : added the follwoing
<Directory C:/vhosts>
Require all granted
</Directory>
<VirtualHost *:80>
DocumentRoot "C:/Bitnami/wampstack-7.1.15-0/apache2/htdocs/website/"
ServerName website.local
</VirtualHost>
when i start browsing the site and click on any subpage i got a 404 (Not Found)
please advise.
Seems like you are missing some directives on the directory level. Here is a config that works that basically follows https://www.drupal.org/node/953296#comment-9866119
<VirtualHost *:80>
DocumentRoot /home/myrepo/mydocroot
ServerName mysite.localhost
<Directory /home/myrepo/mydocroot >
Options FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
You might need to activate the mod_rewrite in apache.
Edit the httpd.conf and search for "#LoadModule rewrite_module modules/mod_rewrite.so" remove the "#". Save and restart the apache.
I bought a VPS server, where I installed apache, mysql, php and phpmyadmin. I created database (like in my local project).
So, now I want to migrate a local project to my server and please, tell me I am right:
Files .php has to be in folder var/www on my apache server? (here is index.html too) and from this folder connect with database?
I have to download NPM on ubuntu
I have to download GIT on ubuntu
Download repo from my github where I've got whole code (webpack dist files, node modules, src and whole config) to /var/www catalog
index.html has to be in top-level directory (just in var/www not for example var/www/src
Please help me and tell if I am thinking right.
Files .php has to be in folder var/www on my apache server? (here is index.html too) and from this folder connect with database?
It depends on what you set in /etc/apache2/sites-available/000-default.conf. I assume that you installed with default configuration from apt-get.
index.html has to be in top-level directory (just in var/www not for example var/www/src
If for example your source codes are in /var/www/src instead of /var/www, the just modify the 000-default.conf. Example:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
ServerName your_domain_name.com
DocumentRoot /var/www/src/
<Directory />
Options FollowSymLinks
AllowOverride None
Options -Indexes
</Directory>
<Directory /var/www/src>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
Options -Indexes
</Directory>
ErrorLog /var/log/your_log_file.log
LogLevel warn
CustomLog /var/log/your_access_log_file.log combined
</VirtualHost>
Restart Apache and try open in your browser to see if it works.
As for the database, since you have phpmyadmin, just export the sql data from your local machine and import it into the VPS phpmyadmin.
I'm trying to setup my local web server using vagrant. My vagrant shared folder is in my home folder (~/home/vagrant/www) and I want to use bindfs to mount this folder inside /var/www.
These are the specs of my virtual machine:
Apache/2.4.23 (Ubuntu)
PHP 7.0.12
Ubuntu 14.04
I am using php-fpm to execute php scripts but after using bindfs, my site will always return File not found.
Also here is my virtualhost configuration:
<VirtualHost *:80>
ServerName project1.dev
## Vhost docroot
DocumentRoot "/var/www/project1/public"
## Directories, there should at least be a declaration for /var/www/project1/public
<Directory "/var/www/project1/public">
Options Indexes FollowSymlinks MultiViews
AllowOverride All
Require all granted
<FilesMatch "\.php$">
Require all granted
SetHandler proxy:fcgi://127.0.0.1:9000
</FilesMatch>
</Directory>
## Logging
ErrorLog "/var/log/apache2/av_anhk5lpgjldb_error.log"
ServerSignature Off
CustomLog "/var/log/apache2/av_anhk5lpgjldb_access.log" combined
## Server aliases
ServerAlias www.project1.dev
## SetEnv/SetEnvIf for environment variables
SetEnv APP_ENV dev
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
## Custom fragment
</VirtualHost>
Anyone can help me?
I manage to successfully run php-fpm + bindfs in my virtual machine. I just made sure that user who is running php-fpm and apache are the one I set in my bindfs command. My apache is run by www-user so I change my command to sudo bindfs -o perms=0755,mirror-only=www-user,force-group=www-data,force-user=www-user /home/vagrant/www /var/www and made sure that apache is also run by www-user.
I have a dedicated server, on which I'm running several project. Lets say this is example.ro.
The server is running CentOS 6.
I've created a unix user 'dev' and a subdomain: dev.example.ro.
Lets say that I want to work on a project called 'cpl', and I have to test it live on this server (it is a php project).
I would like to use the subdomain dev.cpl.example.ro, and on the filesystem it would be under /home/dev/public_html/cpl folder.
How should I modify my .htaccess in the public_html folder in order to dynamically use subdomains?
I don't think you need to edit the .htaccess file to achieve this. But you have to create a separate site in Apache server. To demonstrate I am using am ubuntu lamp server but I think you can do the same on your CentOS.
Create a virtual site in Apache
sudo nano -w /etc/apache2/sites-available/example.conf
paste the following into the file and make necessary changes
<VirtualHost *:80>
ServerName cpl.example.ro
ServerAlias *.cpl.example.ro
DocumentRoot /home/dev/public_html/cpl
<Directory />
#Options FollowSymLinks
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Save the file. After that you need to enable the newly site.
sudo a2ensite example
service apache2 restart
Edit the host file to resolve the dev.cpl.example.ro
sudo nano -w /etc/hosts
add the following line to the end and save the file
127.0.0.1 dev.cpl.example.ro