阿龍 发表于 2012-6-25 00:26:56

修改nginx.conf 原始备份被删除了(急)

疑问1:
修改nginx.conf 的时候不小心将原始备份给删除了,文件修改server段,现在无法还原了,
原始状态下 IP直接访问wwwroot文件夹 而不是直接访问网站

经过我修改以后,输入IP后直接打开目标网站,但是现在问题是 phpmyadmin 无法开打了!!

目前nginx.conf server段为:server
{
listen       80;
server_name x.com;
index index.html index.htm index.php;
root/home/wwwroot;重启VPS后,IP依旧访问网站而不是 wwwroot文件夹 这样的话我依旧无法进入phpmyadmin 数据没备份所以不能重装系统!

疑问2 :这种状态下能不能将X.COM 修改成我的二级域名,使它访问wwwroot
然后IP继续访问到网站而不是wwwroot ?要如何修改?

我是菜鸟 求各位大侠指点!

[ 本帖最后由 阿龍 于 2012-6-25 00:28 编辑 ]

kuailerener 发表于 2012-6-25 04:35:22

呵呵,其实这个文件很容易记住的

userwww www;

worker_processes 2;                                       #nginx处理进程数

error_log/home/wwwlogs/nginx_error.logcrit;      #生成nginx错误日志路径

pid      /usr/local/nginx/logs/nginx.pid;

worker_rlimit_nofile 51200;                           #每个nginx进程打开的最多文件描述符数目

events
        {
                use epoll;
                worker_connections 51200;               #每个nginx进程允许的最多连接数
        }

http
        {
                include       mime.types;
                default_typeapplication/octet-stream;

                server_names_hash_bucket_size 128;
                client_header_buffer_size 32k;
                large_client_header_buffers 4 32k;
                client_max_body_size 50m;

                sendfile on;
                tcp_nopush   on;
      server_tokens off;   #关闭nginx版本号
                keepalive_timeout 60;                        #keepalive 超时时间
                tcp_nodelay on;

                fastcgi_connect_timeout 300;
                fastcgi_send_timeout 300;
                fastcgi_read_timeout 300;
                fastcgi_buffer_size 64k;
                fastcgi_buffers 4 64k;
                fastcgi_busy_buffers_size 128k;
                fastcgi_temp_file_write_size 256k;

                gzip on;                                    #开启gzip压缩
                gzip_min_length1k;
                gzip_buffers   4 16k;
                gzip_http_version 1.0;
                gzip_comp_level 2;
                gzip_types       text/plain application/x-javascript text/css application/xml;   #需要压缩的文件类型
                gzip_vary on;

                #日志格式
                log_formataccess'$remote_addr - $remote_user [$time_local] "$request" '
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';


server {
                listen       80 default;      #空主机头访问301跳转
                rewrite ^(.*) http://www.dianyingchina.com permanent;   
               }

server
        {
                listen       80;
                server_name www.dianyingchina.com;            #绑定域名
                index index.html index.htm index.php;
                root/home/wwwroot/;                                          #网站存放目录

                location ~ .*\.(php|php5)?$
                        {
                                try_files $uri =404;
                                fastcgi_passunix:/tmp/php-cgi.sock;
                                fastcgi_index index.php;
                                include fcgi.conf;
                        }

                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css)$
                        {
                        expires      30d;       #缓存时间
                        }

                        access_log   off;          #关闭日志
        }

include vhost/*.conf;    #加载vhost目录的其他虚拟主机配置文件
      }

kuailerener 发表于 2012-6-25 04:40:48

再加一个phpmyadmin绑定 这样比较好管理,以下server可以新建
也可以加在ngin.conf中include vhost/*.conf;    #加载vhost目录的其他虚拟主机配置文件
的前面
server
        {
                listen       80;
                server_name phpmyadmin.abc.com;            #绑定域名
                index index.html index.htm index.php;
                root/home/wwwroot/phpmyadmin;                        #网站存放目录

                location ~ .*\.(php|php5)?$
                        {
                                try_files $uri =404;
                                fastcgi_passunix:/tmp/php-cgi.sock;
                                fastcgi_index index.php;
                                include fcgi.conf;
                        }

                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|js|css)$
                        {
                        expires      30d;       #缓存时间
                        }

                        access_log   off;          #关闭日志
        }

id886 发表于 2012-6-25 09:58:37

自己把phpmyadmin 搬到你网站目录下不就成了。简单事情

阿龍 发表于 2012-6-25 10:05:12

谢谢 kuailerener

阿龍 发表于 2012-6-25 10:05:57

原帖由 id886 于 2012-6-25 09:58 发表 https://bbs.vpser.net/images/common/back.gif
自己把phpmyadmin 搬到你网站目录下不就成了。简单事情
囧,原来可以移动啊 因为第一次用VPS 目录下的文件我都不敢动
页: [1]
查看完整版本: 修改nginx.conf 原始备份被删除了(急)