我能自己创建虚拟机吗? 不通过 ./vhost.sh来创建

问答中心我能自己创建虚拟机吗? 不通过 ./vhost.sh来创建
jiang asked 8年 ago
我自己创建的虚拟机不能用

server {
        listen   80;
        server_name  evathumber.avnpc.com;
        location / {
                root  /usr/www/EvaThumber/;
                index index.php index.html index.htm;
                if (!-e $request_filename){
                   rewrite ^/(.*)$ /index.php last;
                }
        }
        location ~ \.php$ {
                include fastcgi_params;
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME  /usr/www/EvaThumber/$fastcgi_script_name;
        }
}
 

5 Answers
oneinstack answered 8年 ago
默认oneinstack php-fpm启动是sock不是9000端口

jiang answered 8年 ago
好的知道了,对nginx不是很熟悉
 

jiang answered 8年 ago
那我上边这种配置在 oneinstack 里边配置的话直接 ./vhost.sh 一步步设置就行了?还需要配置什么吗?
 

oneinstack answered 8年 ago
不需要

jiang answered 8年 ago
@oneinstack
我把项目里边的 .htaccess内容改写成nginx之后还是不能访问,我哪个地方写错了吗? url重写还是不生效

server {
listen 80;
server_name img.zoo521.com;
access_log /data/wwwlogs/img.zoo521.com_nginx.log combined;
index index.html index.htm index.php;
#include /usr/local/nginx/conf/rewrite/img.zoo521.conf;
root /data/wwwroot/img.zoo521.com;
   location / {
       if (!-e $reauest_filename) {
        rewrite ^/(.*)$ /index.php last;
        break;
       }
   }
location ~ [^/]\.php(/|$) {
    #fastcgi_pass remote_php_ip:9000;
    fastcgi_pass unix:/dev/shm/php-cgi.sock;
    fastcgi_index index.php;
    include fastcgi.conf;
    }
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|ico)$ {
    expires 30d;
    access_log off;
    }
location ~ .*\.(js|css)?$ {
    expires 7d;
    access_log off;
    }
}
# ----------------------------------------------------------------------
# CORS-enabled images (@crossorigin)
# ----------------------------------------------------------------------

# Send CORS headers if browsers request them; enabled by default for images.
# developer.mozilla.org/en/CORS_Enabled_Image
# blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html
# hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/
# wiki.mozilla.org/Security/Reviews/crossoriginAttribute
<IfModule mod_setenvif.c>
  <IfModule mod_headers.c>
    # mod_headers, y u no match by Content-Type?!
    <FilesMatch "\.(gif|ico|jpe?g|png|svg|svgz|webp)$">
      SetEnvIf Origin ":" IS_CORS
      Header set Access-Control-Allow-Origin "*" env=IS_CORS
    </FilesMatch>
  </IfModule>
</IfModule>

# FileETag None is not enough for every server.
<IfModule mod_headers.c>
  Header unset ETag
</IfModule>

# Since we're sending far-future expires, we don't need ETags for
# static content.
#   developer.yahoo.com/performance/rules.html#etags
FileETag None


<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</IfModule>