Apache Server development environment - php

I´m trying to explain he problem I have.
I usually use XAMPP or MAMP for this but I want to use the Apache Server that comes with OS X High Sierra by default installed.
So, OS X has apache server and php installed for default and they work great without a problem, and the localhost works fine with many other projects I have like angular and php.
My issue is this...
I tried to install a dev environment on my computer for php-laravel projects so after I installed laravel with homebrew and do some changes in the files:
/private/etc/apache2/extra/httpd-vhosts.conf
/private/etc/apache2/httpd.conf
/etc/hosts
httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "~/Sites"
#VirtualDocumentRoot "~/Sites"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "~/Sites/cms/public"
ServerName cms.test
ServerAlias *.test
</VirtualHosts>
httpd.conf
ServerRoot "/usr"
<IfDefine SERVER_APP_HAS_DEFAULT_PORTS>
Listen 8080
</IfDefine>
<IfDefine !SERVER_APP_HAS_DEFAULT_PORTS>
Listen 80
</IfDefine>
User myusername
ServerName localhost:80
DocumentRoot "/Users/myusername/Sites"
<Directory "/Users/myusername/Sites">
Options All
MultiviewsMatch Any
AllowOverride All
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf
hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
127.0.0.1 cms.test
After this I restarted the server and when I tried to go to:
localhost
I just wrote on chrome browser localhost
If I tried localhost/info.php
localhost/info.php
As you can see inside the Sites folder there are an info.php file
folder Sites is where ServerDirectory is and as you can see there are an info.php file
when I tried localhost/cms/public/index.php
the result is the same
I execute $ whereis httpd and the result is /usr/sbin/httpd
then I executed $ /usr/sbin/httpd -V and the result is
Server version: Apache/2.4.28 (Unix)
Server built: Oct 9 2017 19:54:20
Server's Module Magic Number: 20120211:68
Server loaded: APR 1.5.2, APR-UTIL 1.5.4
Compiled using: APR 1.5.2, APR-UTIL 1.5.4
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_FLOCK_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D DYNAMIC_MODULE_LIMIT=256
-D HTTPD_ROOT="/usr"
-D SUEXEC_BIN="/usr/bin/suexec"
-D DEFAULT_PIDLOG="/private/var/run/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types"
-D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"
I also executed the command apachectl -S
and the result is
VirtualHost configuration:
ServerRoot: "/usr/local/opt/httpd"
Main DocumentRoot: "/usr/local/var/www"
Main ErrorLog: "/usr/local/var/log/httpd/error_log"
Mutex rewrite-map: using_defaults
Mutex default: dir="/usr/local/var/run/httpd/" mechanism=default
Mutex mpm-accept: using_defaults
PidFile: "/usr/local/var/run/httpd/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="_www" id=70
Group: name="_www" id=70
I can see two different configurations and I do not know what I can do to fix this.
So that is why I am asking for help, I really don´t know what else I can do to fix this.

1) It looks like you have apache installed in multiple locations. Check to make sure. Do:
find /usr -name apachectl
If you get more than one result, then it is likely you have installed one version from Homebrew (which will install apachectl in /usr/local/bin, and set the PidFile directive for it's configuration file to /usr/local/var/run/httpd/httpd.pid) and, have another version that comes with Sierra, which will install in /usr/sbin, your system binary folder (and in my experience with this problem, set the PidFile to run in /etc/var/run/).
"Whereis" does not return the apachectl which has precedence (ie, which one you are calling when you execute the command). A better command is:
which apachectl
Which will reveal which apachectl you are currently using when you type in apachectl.
If it turns out you have multiple installations, you will need to set precedence for the version of apachectl you want in your ~/.bash_profile.
The reason why you are seeing two different configurations is because you are checking one's configuration with /usr/sbin/httpd - the apache that comes native with Sierra, and checking the other's configuration files with apachectl -S, which is likely calling the httpd installed by Homebrew.
2) Preventing access to a directory can be a problem that results from not having the correct permissions on the files themselves. Often you will need to
chown -R user:group dir_name
the the directory, where user and group are what the user is listed as in your configuration file. On my machine, this is _www for both in the configuration file.

Related

Apache is using a different port and Document Root than is in the config file

I am trying to get apache running locally with php, but for some reason, my apache is running on port 8080 instead of port 80 and it is using a different document root than is defined in the httpd.conf
When I run /usr/sbin/httpd -V it tells me where my server config file is
-D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"
I went to that file and it has this for Listen:
<IfDefine SERVER_APP_HAS_DEFAULT_PORTS>
Listen 8080
</IfDefine>
<IfDefine !SERVER_APP_HAS_DEFAULT_PORTS>
Listen 80
</IfDefine>
And this for document root:
DocumentRoot "/Library/WebServer/Documents"
apachectl -S also says Main DocumentRoot: "/Library/WebServer/Documents"
Earlier today it was saying /usr/local/var/www but i fixed that, but apache is still using /usr/local/var/www as the document root. Any ideas on what's causing this? My apache server is also not running the php it is just showing as plain text, not sure if that is related or not
Finally figured it out, I ran /usr/local/opt/httpd/bin/httpd -V | grep SERVER_CONFIG_FILE and that gave me -D SERVER_CONFIG_FILE="/usr/local/etc/httpd/httpd.conf" which was the actual config file it was using, I fixed that one and now its working.

Laravel not working showing Apache default page on localhost. Virtual Host changes failed

I have to make LAravel app and to deliver a Dockerfile ,but i'm realy stuck with this. Before that I had a nightmare wile installing laravel on my machine.
I'm trying to get dockervel image and I'm following the steps here: http://www.spiralout.eu/2015/12/dockervel-laravel-development.html
I had problems before and made changes :Error starting userland proxy: listen tcp0.0.0.0:3306: bind: address already in use
All good till the step
fix permissions: dpermit Now you have a registration system active. Go
to localhost and register a new user to see that db's are running ok.
When I go to localhost I get : Apache2 Ubuntu Default Page
https://assets.digitalocean.com/articles/lamp_1404/default_apache.png
I have catched this : when I run
$ dcomposer-create
It gets to the end but I get this
Warning: This development build of composer is over 60 days old. It is recommended to update it by running "/usr/bin/composer self-update" to get the latest version.
Installing laravel/laravel (v5.2.31)
- Installing laravel/laravel (v5.2.31)
Downloading: 100%
Created project in /var/www
> php -r "copy('.env.example', '.env');"
Shoud I move on eith installation or first fix this?
I alredy have a laravel project in var/www/laravel (on local laravel environment).
And my etc/hosts file looks like :
127.0.0.1 laravel.example.com
127.0.1.1 me-Lenovo-Z50-75
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 laravel.example.com
And $ dcomposer-create creates application in dockervel/www/ .
I have changeg now made dockervel.example.com.conf in /etc/apache2/sites-available
<VirtualHost *:80>
ServerName dockervel.example.com
DocumentRoot /home/me/Desktop/dockerlaravel/dockervel/www/public
DirectoryIndex index.php
<Directory /home/me/Desktop/dockerlaravel/dockervel/www>
Options FollowSymLinks
AllowOverride None
</Directory >
<Directory >
AllowOverride All
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
And changed /etc/hosts
127.0.0.1 dockervel.example.com
127.0.1.1 me-Lenovo-Z50-75
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.0.1 dockervel.example.com
I also run:
$ a2ensite dockervel.example.com
$ sudo service apache2 reload
And When I run :
apachectl -S
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
VirtualHost configuration:
*:80 is a NameVirtualHost
default server 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost 127.0.1.1 (/etc/apache2/sites-enabled/000-default.conf:1)
port 80 namevhost dockervel.example.com (/etc/apache2/sites-enabled/dockervel.example.com.conf:1)
port 80 namevhost laravel.example.com (/etc/apache2/sites-enabled/laravel.example.com.conf:1)
ServerRoot: "/etc/apache2"
Main DocumentRoot: "/var/www"
Main ErrorLog: "/var/log/apache2/error.log"
Mutex watchdog-callback: using_defaults
Mutex default: dir="/var/lock/apache2" mechanism=fcntl
Mutex mpm-accept: using_defaults
PidFile: "/var/run/apache2/apache2.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="www-data" id=33
Group: name="www-data" id=33
And when I continue with the instalation
$ dnodejs nmp install - this is ok
$ dnodejs gulp install
[17:40:09] Using gulpfile /var/www/gulpfile.js
[17:40:09] Task 'install' is not in your gulpfile
[17:40:09] Please check the documentation for proper gulpfile formatting
As you can see ,All goes in /var/www but I want it to be in my working directory /home/me/Desktop/dockerlaravel/dockervel .
I can not see what is the problem is the problem?
Since you have changed the port to "8084" you should go to localhost:8084
If you see the apache default then you probably are browsing another server since dockervel is build upon nginx.
You have also probably have some gaps on Docker. Don't mix your local storage with docker storage. /var/www in a container is different than your local /var/www. in docker-compose.yml you mount the local ~/dockervel/www to containers /var/www.
I would suggest that you start all over again and revert the changes you've made to your apache server. Shut it down, you don't need it. Dockervel will provide you with an NginX server in a container.

Xubuntu Linux - Why doesn't my localhost direct me to my virtual host site?

I am setting up a virtual host on my linux machine, I followed all the steps and guides, but I do not go to my site for some reason. I have LAMP installed and apache, mysql, php is all working. I have a database setup on phpmyadmin and imported a database, but for some reason I cannot get my IP directed to my site! Its literally the last step I need so I can start working on my project.
127.0.0.1 localhost
127.0.0.1 cbirc.com
<VirtualHost *:80>
ServerAdmin admin#cbirc.com
ServerName cbirc.com
ServerAlias www.cbirc.com
DocumentRoot /var/www/cbirc
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
What am I missing here???
You have to check bunch of stuff:
Is apache running
sudo service apache2 status
Afterwards, test it with
netstat -na | grep 80
ping cbirc.com
Was website enabled by issuing following command?
sudo a2ensite cbirc
file /etc/apache2/sites-enabled/cbirc.conf (or some similar name it that folder)
Does www-data group and user (apache) has read-execute access on web content folder
ln -l /var/www/cbirc
If not, change it like this
sudo chown -R www-data:www-data /var/www/cbirc
sudo chmod -R ug+rx /var/www/cbirc
Before issuing request in browser (to eliminate browser cache or security issues), do it with curl or wget
wget http://cbirc.com/
curl -v http://cbirc.com/
And look for errors in logifile
tail -f /var/log/apache2/error.log
Please refer to my debian cheetsheat for further help
Firstly, run 'dig' or 'host' on cbirc.com
Although it is in your /etc/hosts , resolv.conf may prioritise nameservers above your hosts file.
If it is pointing to your localhost, then check the you have enabled the site - a2ensite [name of vhost conf file without the .conf extention] - check by looking in /etc/apache2/sites-enabled for a symbolic link to the sites-available directory.

VirtualHost is not working under Apache 2.4.6 on CentOS 7

I'm trying to setup some VH in Apache 2.4.6 on CentOS 7 but without success since it's not working. This is what I've tried til now:
Since in /etc/httpd/conf/httpd.conf is this line Include conf.modules.d/*.conf then I create a file under /etc/httpd/conf.d/vhost.conf and place this inside it:
NameVirtualHost *:80
<VirtualHost *:80>
ServerName webserver
ServerAlias localhost devserver development
DocumentRoot /var/www/html
</VirtualHost>
Reload/Restart Apache service (tried both):
service httpd reload|restart
At Windows side edit the file C:\Windows\system32\drivers\etc\hosts and add this line:
192.168.3.131 webserver localhost devserver development # this is the IP of Apache Server
Open the browser and tried: http://webserver, http://devserver and both goes to default Apache page so VH is not working.
Place a file under /var/www/html/index.php with this lines <?php phpinfo(); ?> just to know which modules is Apache loading, this is the result:
core mod_so http_core mod_access_compat mod_actions mod_alias mod_allowmethods mod_auth_basic mod_auth_digest
mod_authn_anon mod_authn_core mod_authn_dbd mod_authn_dbm mod_authn_file mod_authn_socache mod_authz_core
mod_authz_dbd mod_authz_dbm mod_authz_groupfile mod_authz_host mod_authz_owner mod_authz_user mod_autoindex
mod_cache mod_cache_disk mod_data mod_dbd mod_deflate mod_dir mod_dumpio mod_echo mod_env mod_expires mod_ext_filter
mod_filter mod_headers mod_include mod_info mod_log_config mod_logio mod_mime_magic mod_mime mod_negotiation
mod_remoteip mod_reqtimeout mod_rewrite mod_setenvif mod_slotmem_plain mod_slotmem_shm mod_socache_dbm
mod_socache_memcache mod_socache_shmcb mod_status mod_substitute mod_suexec mod_unique_id mod_unixd mod_userdir
mod_version mod_vhost_alias mod_dav mod_dav_fs mod_dav_lock mod_lua prefork mod_proxy mod_lbmethod_bybusyness
mod_lbmethod_byrequests mod_lbmethod_bytraffic mod_lbmethod_heartbeat mod_proxy_ajp mod_proxy_balancer mod_proxy_connect
mod_proxy_express mod_proxy_fcgi mod_proxy_fdpass mod_proxy_ftp mod_proxy_http mod_proxy_scgi mod_systemd mod_cgi mod_php5
And apparently mod_vhost is loaded but is not working, did I miss something? Any help or advice around this? Maybe I forgot something but I read Apache docs and doesn't found something helpful
Update: test1
I made some changes to VH definition and now this is what I have:
<VirtualHost *:80>
DocumentRoot /var/www/html
ServerName webserver
#ServerAlias localhost devserver development
<Directory "/var/www/html">
Options FollowSymLinks Includes ExecCGI
AllowOverride All
Allow from all
#Require local
#Require 192.168.3.0/16
#Require 192.168.1.0/16
</Directory>
</VirtualHost>
But I'm getting a 403 Forbidden
Forbidden
You don't have permission to access /index.php on this server.
What is failing here?
To elaborate on jap1968's post, CentOS 7 comes with SELinux's pain in the butt level set to enforcing. This causes all kinds of confusion when perfectly normal service configuration silently fail (Apache).
To disable SELinux you'll need to:
0) [optional] Crack open a shell and become root... or enjoy a shiny new, super fun, configuring sudo to let you do "root stuffs" project. Probably.
su -l
1) Get the current status of SELinux. Run sestatus:
sestatus
2) If SELinux is causing hair loss and premature aging you'll get something like this:
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28
3) Edit the /etc/selinux/config file. Change SELINUX=enforcing to SELINUX=permissive. Doing this will set you up for endless joy next time you reboot. You'll end up with something like this:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
# SELINUX=enforcing
# ===> VOODOO HERE <===
SELINUX=permissive
# ===> END VOODOO <===
#
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
4) Disable SELinux. You can reboot at this point but it's easier to tell SELinux to take time off from tormenting you. Run setenforce to reset SELinux's enforcement level to match the /etc/selinux/config file:
setenforce 0
5) Check sestatus again:
sestatus
If everything went as expected sestatus will return something like this:
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: permissive
Policy MLS status: enabled
Policy deny_unknown status: allowed
Max kernel policy version: 28
6) Restart Apache. If your vhost's domain name is resolving to the server you're working on you'll see your shiny new virtual host:
# Restart apache:
systemctl restart httpd.service
# Be lazy by checking your virtual host from the command line:
curl www.example.com/new-file-that-only-exists-in-your-new-vhost.txt
6.5) Stop reading here. Or don't. I'm a message board post, not your Mom.
Everything below is beyond the scope of the original question and only included because you really should be running with SELinux enabled.
7) Work towards re-enabling selinux. Start by watching the selinux logs to see some awesome alphabet soup:
tail -f /var/log/audit/audit.log
8) Be amazed at the depth of features, crazy number of poorly named utilities, and ugly UX mess that constitutes SELinux. You should probably put on your big boy pants and drink a whole pot of coffee before you dive in. Here's some Info:
CentoOS HowTo: https://wiki.centos.org/HowTos/SELinux
Project: http://selinuxproject.org/page/Main_Page
A couple of thing that may be causing you problems :-
NameVirtualHost *:80
Is no longer a valid syntax for Apache 2.4.x you should remove it completely.
On the Windows side once you have changed the HOSTS file, you need to reload the DNS Client service, so either reboot or better still, launch a command window using "Run as Administrator" and do this :-
net stop dnscache
net start dnscache
Lastly, within your virtual hosts definition, it will help to tell apache from where it is allowed to accept connections to this Virtual Host like so :-
<VirtualHost *:80>
ServerName webserver
ServerAlias localhost devserver development
DocumentRoot /var/www/html
<Directory "/var/www/html">
AllowOverride All
Require local
Require ip 192.168.3
</Directory>
</VirtualHost>
This will allow access from the machine running apache Require local and from any ip address on the local network Require ip 192.168.3
Also I am not sure where Apache on unix puts its default document root but it might be an idea to differentiate your 3 domain names to different directories like so
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot /var/www/html
<Directory "/var/www/html">
AllowOverride All
Require local
Require ip 192.168.3
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName webserver
ServerAlias webserver
DocumentRoot /var/www/html/webserver
<Directory "/var/www/html/webserver">
AllowOverride All
Require local
Require ip 192.168.3
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName development
ServerAlias development
DocumentRoot /var/www/html/development
<Directory "/var/www/html/development">
AllowOverride All
Require local
Require ip 192.168.3
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName devserver
ServerAlias devserver
DocumentRoot /var/www/html/devserver
<Directory "/var/www/html/devserver">
AllowOverride All
Require local
Require ip 192.168.3
</Directory>
</VirtualHost>
Then put a simple html file in each directory saying 'Hello from Servername' and change servername in each file so you know you have got to the correct server.
RE: Update test1.php
Allow from all
Is not valid Apache 2.4 syntax either, unless you have loaded LoadModule access_compat_module modules/mod_access_compat.so
Even then it should be
Order Allow,Deny
Allow from all
So USE Apache 2.4 syntax
Require all granted
If you want to take the lazy route and allow access from the universe.
Be careful also with SELinux. The default configuration will prevent your virtual hosts directories from being accessed by httpd. You will need to set the appropriate context:
# chcon -R -u system_u -r object_r -t httpd_sys_content_t <DocumentRoot>
Another option is just to disable SELinux.

Apache Virtual host shows blank page over Internet, works fine locally

Please do not answer until you read the full question :)
In a freshly created DigitalOcean CentOS 6.5 (64 bit) server, I tried creating two Apache virtual hosts - www.example-rose.com and www.example-tulip.com by issuing following commands:
Server Side Setup
# software installation
yum install httpd mod_fcgid php-cli
# added cgi.fix_pathinfo=1 in /etc/php.ini
echo "cgi.fix_pathinfo=1" >> /etc/php.ini
echo "PHP_Fix_Pathinfo_Enable 1" >> /etc/httpd/conf.d/fcgid.conf
# added new users and groups for the two virtual sites
groupadd rose
groupadd tulip
useradd -s /bin/false -d /var/www/rose -m -g rose rose
useradd -s /bin/false -d /var/www/tulip -m -g tulip tulip
chmod 755 /var/www/rose
chmod 755 /var/www/tulip
# create new document root and make them own by respective users
mkdir -p /var/www/rose/web
chown rose:rose /var/www/rose/web
mkdir -p /var/www/tulip/web
chown tulip:tulip /var/www/tulip/web
Now since I want to run PHP through SuEXEC, I have done following additional steps of creating a wrapper script for SuEXEC
mkdir -p /var/www/php-fcgi-scripts/rose
mkdir -p /var/www/php-fcgi-scripts/tulip
# inside the wrapper, I added a file (/var/www/php-fcgi-scripts/rose/php-fcgi-starter)
# with below content:
#!/bin/sh
PHPRC=/etc/
export PHPRC
export PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_CHILDREN=8
exec /usr/bin/php-cgi
# changed the permission
chmod 755 /var/www/php-fcgi-scripts/rose/php-fcgi-starter
chown -R rose:rose /var/www/php-fcgi-scripts/rose
# above steps are repeated for tulip as well
Then finally I added the following content in my httpd.conf file to enable the virtual hosting
NameVirtualHost *:80
<VirtualHost *:80>
ServerName www.example-rose.com
ServerAlias example-rose.com
ServerAdmin webmaster#example-rose.com
DocumentRoot /var/www/rose/web/
<IfModule mod_fcgid.c>
SuexecUserGroup rose rose
<Directory /var/www/rose/web/>
Options +ExecCGI
AllowOverride All
AddHandler fcgid-script .php
FCGIWrapper /var/www/php-fcgi-scripts/rose/php-fcgi-starter .php
Order allow,deny
Allow from all
</Directory>
</IfModule>
ErrorLog /var/www/rose/error.log
CustomLog /var/www/rose/access.log combined
ServerSignature Off
</VirtualHost>
<VirtualHost *:80>
... similar lines for the second virtual host (Tulip). Cutting short ...
</VirtualHost>
I restarted the server and put one index.php file in the web directory with following content : <?php phpinfo(); ?>.
Local Machine
In order to test the virtual hosts, I issued following commands from my local machine using curl
$> curl -v -H "www.example-rose.com" 162.*.35.155/index.php
* Trying 162.*.35.155...
* Connected to 162.*.35.155 port 80 (#0)
> GET /index.php HTTP/1.1
> User-Agent: curl/7.30.0
> Host: www.example-rose.com
> Accept: */*
>
* Empty reply from server
* Connection #0 to host 162.*.35.155 left intact
curl: (52) Empty reply from server
If I try accessing through web browser instead of curl (after creating /etc/hosts entry for the domains), I get blank page. No Apache Access log or error log is generated in the server. If I put a static file (instead of php file), I can access the static file without any issue. But .php file does not work.
However
When I try to curl from the DigitalOcean's server itself (or from some other server within DigitalOcean's network), I get to see the expected index.php with phpinfo() results without any issue. But doesn't work when I try from outside DO's network.
I have done all sorts common troubleshooting (installing, re-installing, checking permissions, checking conf files again and again etc.) and I am at my wit's end now. Next what?
Please do not answer until you read the full question :)

Categories