1
donald 2013-06-25 23:04:14 +08:00
你不是放在public_html下,域名也应该指向public_html下啊。
|
2
AstroProfundis 2013-06-25 23:04:52 +08:00
目测你放博客的地方和域名指向的地方不一样
|
3
yousurm OP @AstroProfundis @donald 已重新指向 还是不可以~
|
6
Ansonyi 2013-06-25 23:13:30 +08:00
Rewrite的问题?或者权限?
|
8
yousurm OP @donald
是这个吗? #user nobody; worker_processes 1; #error_log logs/error.log; #error_log logs/error.log notice; #error_log logs/error.log info; #pid logs/nginx.pid; events { worker_connections 1024; } http { include mime.types; default_type application/octet-stream; #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' # '$status $body_bytes_sent "$http_referer" ' # '"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; sendfile on; #tcp_nopush on; #keepalive_timeout 0; keepalive_timeout 65; #gzip on; server { listen 80; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ \.php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} } # another virtual host using mix of IP-, name-, and port-based configuration # #server { # listen 8000; # listen somename:8080; # server_name somename alias another.alias; # location / { # root html; # index index.html index.htm; # } #} # HTTPS server # #server { # listen 443; # server_name localhost; # ssl on; # ssl_certificate cert.pem; # ssl_certificate_key cert.key; # ssl_session_timeout 5m; # ssl_protocols SSLv2 SSLv3 TLSv1; # ssl_ciphers HIGH:!aNULL:!MD5; # ssl_prefer_server_ciphers on; # location / { # root html; # index index.html index.htm; # } #} } |
10
yousurm OP @manoon 搞不懂啊 第一次用VPS弄主机 Lnmp是别人帮我弄好的,目前想自己新建个博客 搞不明白了。errorlog不知道该如何去除注释 囧。。。。
|
11
manoon 2013-06-25 23:54:20 +08:00 1
想学习NGINX相关的东西,就踏踏实实把相关的文档看完。
如果只想搭个博客的话。 直接yum install httpd php mysql php-* mysql-* 然后简单的编辑一下配置文件,就足够了。 |
12
iCodex 2013-06-25 23:56:54 +08:00
初学者建议用apache,nginx还是以后熟悉之后再说吧。
|
14
itommy 2013-06-26 00:58:54 +08:00 2
可以重来的话,LAMP 就好了,有很详细的 tutorial 在 digital ocean 的官网上
https://www.digitalocean.com/community/articles/how-to-install-wordpress-on-ubuntu-12-04 要是继续坚持 nginx 的话: https://www.digitalocean.com/community/articles/how-to-install-wordpress-with-nginx-on-ubuntu-12-04 |
15
yousurm OP @donald 这个VPS上之前已经有别人帮我安装好一个域名的博客。那意思是说,要新建网站的话,所有东西都要重新配置一遍是吗? 还有具体哪些东西是需要重新配置的?
|
18
yexiaoxing 2013-06-26 08:16:04 +08:00 via Android
用的是lnmp吧,看nginx下有没有vhost目录,贴出来
|
19
yousurm OP @yexiaoxing 嗯 是的 Vhost.sh是这样的:
#!/bin/bash # Check if user is root if [ $(id -u) != "0" ]; then echo "Error: You must be root to run this script, use sudo sh $0" exit 1 fi clear echo "=========================================================================" echo "Add Virtual Host for LNMP V0.9 , Written by Licess " echo "=========================================================================" echo "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux " echo "This script is a tool to add virtual host for nginx " echo "For more information please visit http://www.lnmp.org/" echo "" echo "=========================================================================" if [ "$1" != "--help" ]; then domain="www.lnmp.org" echo "Please input domain:" read -p "(Default domain: www.lnmp.org):" domain if [ "$domain" = "" ]; then domain="www.lnmp.org" fi if [ ! -f "/usr/local/nginx/conf/vhost/$domain.conf" ]; then echo "===========================" echo "domain=$domain" echo "===========================" else echo "===========================" echo "$domain is exist!" echo "===========================" fi echo "Do you want to add more domain name? (y/n)" read add_more_domainame if [ "$add_more_domainame" == 'y' ]; then echo "Type domainname,example(bbs.vpser.net forums.vpser.net luntan.vpser.net):" read moredomain echo "===========================" echo domain list="$moredomain" echo "===========================" moredomainame=" $moredomain" fi vhostdir="/home/wwwroot/$domain" echo "Please input the directory for the domain:$domain :" read -p "(Default directory: /home/wwwroot/$domain):" vhostdir if [ "$vhostdir" = "" ]; then vhostdir="/home/wwwroot/$domain" fi echo "===========================" echo Virtual Host Directory="$vhostdir" echo "===========================" echo "===========================" echo "Allow Rewrite rule? (y/n)" echo "===========================" read allow_rewrite if [ "$allow_rewrite" == 'n' ]; then rewrite="none" else rewrite="other" echo "Please input the rewrite of programme :" echo "wordpress,discuz,typecho,sablog,dabr rewrite was exist." read -p "(Default rewrite: other):" rewrite if [ "$rewrite" = "" ]; then rewrite="other" fi fi echo "===========================" echo You choose rewrite="$rewrite" echo "===========================" echo "===========================" echo "Allow access_log? (y/n)" echo "===========================" read access_log if [ "$access_log" == 'n' ]; then al="access_log off;" else echo "Type access_log name(Default access log file:$domain.log):" read al_name if [ "$al_name" = "" ]; then al_name="$domain" fi alf="log_format $al_name '\$remote_addr - \$remote_user [\$time_local] \"\$request\" ' '\$status \$body_bytes_sent \"\$http_referer\" ' '\"\$http_user_agent\" \$http_x_forwarded_for';" al="access_log /home/wwwlogs/$al_name.log $al_name;" echo "===========================" echo You access log file="$al_name.log" echo "===========================" fi get_char() { SAVEDSTTY=`stty -g` stty -echo stty cbreak dd if=/dev/tty bs=1 count=1 2> /dev/null stty -raw stty echo stty $SAVEDSTTY } echo "" echo "Press any key to start create virtul host..." char=`get_char` if [ ! -d /usr/local/nginx/conf/vhost ]; then mkdir /usr/local/nginx/conf/vhost fi echo "Create Virtul Host directory......" mkdir -p $vhostdir touch /home/wwwlogs/$al_name.log echo "set permissions of Virtual Host directory......" chmod -R 755 $vhostdir chown -R www:www $vhostdir if [ ! -f /usr/local/nginx/conf/$rewrite.conf ]; then echo "Create Virtul Host ReWrite file......" touch /usr/local/nginx/conf/$rewrite.conf echo "Create rewirte file successful,now you can add rewrite rule into /usr/local/nginx/conf/$rewrite.conf." else echo "You select the exist rewrite rule:/usr/local/nginx/conf/$rewrite.conf" fi cat >/usr/local/nginx/conf/vhost/$domain.conf<<eof $alf server { listen 80; server_name $domain$moredomainame; index index.html index.htm index.php default.html default.htm default.php; root $vhostdir; include $rewrite.conf; location ~ .*\.(php|php5)?$ { try_files \$uri =404; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fcgi.conf; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } $al } eof echo "Test Nginx configure file......" /usr/local/nginx/sbin/nginx -t echo "" echo "Restart Nginx......" /usr/local/nginx/sbin/nginx -s reload echo "=========================================================================" echo "Add Virtual Host for LNMP V0.9 , Written by Licess " echo "=========================================================================" echo "For more information please visit http://www.lnmp.org/" echo "" echo "Your domain:$domain" echo "Directory of $domain:$vhostdir" echo "" echo "=========================================================================" fi |
20
yousurm OP @yexiaoxing 之前别人帮我配置好,然后把原先的网站转移过来了。现在我想重新添加一个网站,用wordpress搭建。
|
21
nVic 2013-06-26 08:35:07 +08:00 via iPad 1
安装完成后,安装虚拟主机:
/root/vhost.sh www.mydomainname.com+enter y+mydomainname.com+enter(带www和不带www的网址绑定同一虚拟主机) 接下来选择添加伪静态规则。wordpress+enter m/y+enter lnmp环境简单配置完成。 其中伪静态未设置,可以随时添加。 安装wordpress: wget http://wordpress.org/latest.tar.gz (下载wordpress最新版本) tar -zxvf latest.tar.gz /home/wwwroot/www.mydomain.com/ www.mydomain.com/phpmyadmin 选择数据库,点击新建数据库a_db,设定用户名user密码user,设定用户权限 mv /var/www/wp-config-sample.php /var/www/wp-config.php nano /var/www/wp-config.php 找到以下内容 // ** MySQL settings – You can get this info from your web host ** // /** The name of the database for WordPress */ define(‘DB_NAME’, ‘database_name_here’); /** MySQL database username */ define(‘DB_USER’, ‘username_here’); /** MySQL database password */ define(‘DB_PASSWORD’, ‘password_here’); /** MySQL hostname */ define(‘DB_HOST’, ‘localhost’); 改为 // ** MySQL settings – You can get this info from your web host ** // /** The name of the database for WordPress */ define(‘DB_NAME’, ‘a_db’); /** MySQL database username */ define(‘DB_USER’, ‘user’); /** MySQL database password */ define(‘DB_PASSWORD’, ‘user’); /** MySQL hostname */ define(‘DB_HOST’, ‘localhost’); 5,chown -R www:www /home/wwwroot/www.mydomain.com/ 改变权限 6,reboot,重启 这样,输入www.mydomain.com/index.php就可以直接进入wordpress安装了。 |
22
manhere 2013-06-26 08:37:39 +08:00
军哥的lnmp网站目录位于: /home/wwwroot/domain/
|
23
kennedy32 2013-06-26 08:57:14 +08:00 via Android
lamp路过
|
24
yexiaoxing 2013-06-26 09:00:03 +08:00 via Android
@yousurm 你在脚本中输入的路径是什么,你就应该把文件放在哪里呀。
|
25
msg7086 2013-06-26 09:11:26 +08:00
路人表示如果不用LNMP这种第三方解决方案的话,nginx配置起来是非常方便的,至少比apache方便太多了。
|
26
hengzhang 2013-06-26 09:15:39 +08:00
还是推荐用wdcp吧,linux vps中文控制面板。
对于我这种对命令一窍不通的菜鸟来说,这种最实在。 |
27
horsley 2013-06-26 09:32:42 +08:00
军哥的lnmp
新域名网站目录位于: /home/wwwroot/具体域名/ IP访问根目录 : /home/wwwroot/ 不推荐wdcp 漏洞多 又加密非开源 不敢用 |
28
AstroProfundis 2013-06-26 09:36:24 +08:00
你贴的第一个nginx配置文件里面,location / 下面指定了 root html; 所以不对。
另外第二个是生成虚拟主机的脚本不是虚拟主机的配置。 你试试在第一个文件里面加上一行 include /usr/local/nginx/conf/vhost/*.conf; 加载 location / {...} 那段后面。 |
29
66beta 2013-06-26 10:17:00 +08:00
装ubuntu啊,一句话搞定 apt-get install lamp-server^
|
30
b824379598 2013-06-26 10:36:35 +08:00
wdcp一键安装包搞定
|
31
yylzcom 2013-06-26 14:46:54 +08:00
推荐actgod的脚本,是lowendbox的脚本增强版,适用于debian系统
像我这样的懒人可以轻松管理vps(当然肯定比不上GUI) |
32
qingting 2013-06-26 15:19:01 +08:00
网站放在/root目录下, nginx或者php没有权限访问, 自然就是404了。
建议更换目录, 并且添加用户www。 如果觉得操作麻烦,还是用lnmp包吧 |