Php 如何使两个wbesite在Nginx数字海洋服务器上工作
因此,在遵循本教程的同时,在我的NginX服务器上实现两个网站 我创建了两个文件夹,如下所示Php 如何使两个wbesite在Nginx数字海洋服务器上工作,php,nginx,digital-ocean,Php,Nginx,Digital Ocean,因此,在遵循本教程的同时,在我的NginX服务器上实现两个网站 我创建了两个文件夹,如下所示 sudo nano /etc/nginx/sites-available/ideconnect.com 我的文件看起来像这样 server { listen 80; listen [::]:80; root /var/www/ideconnect.com/html; index index.php index.html index.h
sudo nano /etc/nginx/sites-available/ideconnect.com
我的文件看起来像这样
server {
listen 80;
listen [::]:80;
root /var/www/ideconnect.com/html;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name ide-portal.com www.ide-portal.com;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
然后是另一个网站
sudo nano /etc/nginx/sites-available/iclock.com
server {
listen 80 ;
listen [::]:80;
root /var/www/iclock.com/html;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name iclock.in www.iclock.in;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
而且我已经正确地创建了符号链接
sudo ln -s /etc/nginx/sites-available/ideconnect.com /etc/nginx/sites-enabled/ideconnect.com
sudo ln -s /etc/nginx/sites-available/iclock.com /etc/nginx/sites-enabled/iclock.com
之后,当我到达我的ip地址时,我只能看到默认的Nginx页面,现在info.php配置页面也不可见
任何帮助都将不胜感激
谢谢首先,您可以检查两件事:
- 你重启了nginx吗
- 您确定您的nginx配置已设置为包含
文件吗?我认为默认设置是包含所有.com
文件。您可以在nginx配置文件中对此进行检查,然后进行调整或修改符号链接的扩展名.conf
McRyptPHP扩展所需的。www.ideportal.com/public@Vikram那么问题出在哪里,您需要重新启动nginx?顺便说一句,安装php扩展应该很容易,但这取决于您的操作系统。这是我的浏览器问题,我只需按ctrl+f5键,然后它就开始刷新页面。我在数字海洋上运行Ubuntu 14.04provider@Vikram我不使用Ubuntu,但如果我没记错的话,搜索php相关的软件包,然后你就可以用#apt get install…
安装它们。您可能需要mcrypt
和php5 mcrypt
软件包。谢谢,是的,我发现ini文件非常简单。我将尝试安装这些软件包。我是Godaddy VPS的用户,所以一切都是开箱即用的,最近切换到DO并安装了LEMP stack,对我来说有点复杂:D