i followed your guide at http://www.howtoforge.com/installing-nginx-with-php5-and-php-fpm-and-mysql-support-on-centos-6.0 i put my info.php file at /usr/share/nginx/html . my nginx.conf file configuration is: (inside http block) "server { location / { root /usr/share/nginx/html; index index.html index.htm index.php; } location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }" i run it on a virtual machine. my /etc/hosts file is: "127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6" my "inet addr:192.168.0.17" . and when i try localhost/info.php , firefox says: "You have chosen to open info.php which is a: BIN file (20 bytes) from: http://localhost Would you like to save this file?" how to solve this? thanks a lot..
output of netstat -tap Code: Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 *:sunrpc *:* LISTEN 1217/rpcbind tcp 0 0 *:http *:* LISTEN 5433/nginx tcp 0 0 *:x11 *:* LISTEN 1828/X tcp 0 0 *:59638 *:* LISTEN 1322/rpc.statd tcp 0 0 localhost.localdomain:ipp *:* LISTEN 1419/cupsd tcp 0 0 localhost.localdomain:smtp *:* LISTEN 1609/master tcp 0 0 localhost.locald:cslistener *:* LISTEN 5415/php-fpm tcp 0 0 192.168.0.21:58155 ee-in-f132.1e100.net:https ESTABLISHED 5090/chrome --user- tcp 0 0 192.168.0.21:57197 fra07s07-in-f17.1e100:https ESTABLISHED 5090/chrome --user- tcp 0 0 192.168.0.21:43560 www-11-03-frc1.faceboo:http TIME_WAIT - tcp 0 0 192.168.0.21:58741 muc03s01-in-f19.1e100:https ESTABLISHED 5090/chrome --user- tcp 0 0 192.168.0.21:54099 fra07s07-in-f102.1e10:https ESTABLISHED 5090/chrome --user- tcp 0 0 192.168.0.20:48970 195.175.68.121.static.:http ESTABLISHED 1988/clock-applet tcp 0 0 *:sunrpc *:* LISTEN 1217/rpcbind tcp 0 0 *:x11 *:* LISTEN 1828/X tcp 0 0 localhost6.localdomain6:ipp *:* LISTEN 1419/cupsd tcp 0 0 *:38887 *:* LISTEN 1322/rpc.statd contents of /usr/share/nginx/html/info.php file Code: <?php phpinfo(); ?> thanks
i think i solved i tried to add Code: server_name localhost; to my nginx.conf file's server block Code: server { server_name localhost; location / { root /usr/share/nginx/html; index index.html index.htm index.php; } location ~ \.php$ { root html; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } and it works. actually i dont know much about nginx configuration. and dont understand why it didnt work and when i add it why it works? when i add Code: server_name _; and restart nginx, it says: Code: /etc/init.d/nginx restart nginx: [warn] conflicting server name "_" on 0.0.0.0:80, ignored Stopping nginx: [ OK ] Starting nginx: nginx: [warn] conflicting server name "_" on 0.0.0.0:80, ignored [ OK ] and localhost/info.php doesnt work.. why it says so? thanks..
You probably have another vhost that uses Code: server_name _; already. You always need a server_name directive if you want to run multiple vhosts on the same IP because otherwise name-based vhosts don't work (nginx cannot know which vhost to display if there's no server_name directive).