修改Directadmin的Nginx为前端出现问题

/ 0评 / 0

由于sandy 之前的Directadmin已经开了站了,所以再装Nginx出现网站不能访问的问题!

解决办法如下:

进入:/etc/nginx/conf/vhosts

加入nginx文件

[cce]
server {
listen (你的IP):80;
server_name www.163.com 163.com;
access_log /var/log/httpd/domains/163.com.bytes bytes;
access_log /var/log/httpd/domains/163.com.log combined;
root /home/163/domains/163.com/public_html/;
location / {
try_files $uri @backend;
location ~* \.(jpeg|jpg|gif|png|bmp|ico|js|css|swf)$ {
proxy_pass http://(你的IP):81;
include proxy.inc;
include cache.inc;
}
}
location @backend {
internal;
proxy_pass http://(你的IP):81;
include proxy.inc;
}
location ~ .*\.(php|jsp|cgi|pl|py)?$ {
proxy_pass http://(你的IP):81;
include proxy.inc;
}
location ~ .*\.(ftpquota|htaccess|htpasswd|asp|aspx|jsp|asa|mdb)?$ {
deny all;
}
}
[/cce]
修改Apache端的网站配置
进入/usr/local/directadmin/data/users/当前用户/httpd.conf
替换相应的IP和路径
[cce]
# Auto generated apache config file by DirectAdmin version 1.42.1
# Modifying this file is not recommended as any changes you make will be
# overwritten when the user makes any changes to his/her website

# For global config changes that affect all Users, see this guide:
# http://help.directadmin.com/item.php?id=2
# For local config changes that only affect one User, see this guide:
# http://help.directadmin.com/item.php?id=3

# Frontpage requires these parameters in every httpd.conf file or else
# it won't work.
ServerRoot /etc/httpd

<VirtualHost 你的IP:81>

	ServerName www.163.com
	ServerAlias www.163.com 163.com
	ServerAdmin [email protected]
	DocumentRoot /home/163/domains/163.com/public_html
	ScriptAlias /cgi-bin/ /home/163/domains/163.com/public_html/cgi-bin/

	UseCanonicalName OFF

	<IfModule !mod_ruid2.c>
		SuexecUserGroup 163 163
	</IfModule>
	<IfModule mod_ruid2.c>
		RMode config
		RUidGid 163 163
		RGroups apache access
	</IfModule>

	#CustomLog /var/log/httpd/domains/163.com.bytes bytes
	#CustomLog /var/log/httpd/domains/163.com.log combined
	ErrorLog /var/log/httpd/domains/163.com.error.log

	<Directory /home/163/domains/163.com/public_html>
		Options +Includes -Indexes

		php_admin_flag safe_mode OFF

		php_admin_flag engine ON
		php_admin_value sendmail_path '/usr/sbin/sendmail -t -i -f [email protected]'

		php_admin_value open_basedir /home/163/:/tmp:/var/tmp:/usr/local/lib/php/

	</Directory>

</VirtualHost>
<VirtualHost 你的IP:81>
	ServerName admin.163.com
        ServerAlias www.admin.163.com
        Redirect 301 / http://www.163.com/

	SuexecUserGroup 163 163

</VirtualHost>

[/cce]
重启httpd服务和nginx服务
service nginx restart或者service nginx reload
servier httpd restart
新装DA+Nginx前端没这个问题!郁闷!

发表评论

邮箱地址不会被公开。 必填项已用*标注