跳转到帖子
  • 游客您好,欢迎来到黑客世界论坛!您可以在这里进行注册。

    赤队小组-代号1949(原CHT攻防小组)在这个瞬息万变的网络时代,我们保持初心,创造最好的社区来共同交流网络技术。您可以在论坛获取黑客攻防技巧与知识,您也可以加入我们的Telegram交流群 共同实时探讨交流。论坛禁止各种广告,请注册用户查看我们的使用与隐私策略,谢谢您的配合。小组成员可以获取论坛隐藏内容!

    TheHackerWorld官方

php (nginx,apache) 常用配置


HACK1949

推荐的帖子

前台html服务器,测试的时候不加缓存

server {
	listen  82;
	root   D:/phpStudy/WWW/xxx;
	index index.html index.htm;
	location ~ .*\.(css|js|swf|htm|html)$ {
		add_header Cache-Control no-store;
	}
}

php项目 laravel , thinkphp , Ci 都用这个

server {
	listen       83;
	root   D:\phpStudy\WWW\xxx\public; 
	index  index.html index.htm index.php;
	location / {
		try_files $uri $uri/ /index.php?$query_string;
	}
	location ~ \.php$ {
		fastcgi_pass   127.0.0.1:9000;
		fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
		include        fastcgi_params;
	}
}

一般的php项目,例如测试的,非框架

server {
	listen       80;
	server_name  mytest.com test.com;
	root   "D:/phpStudy/WWW/test.com";
	location / {
		index  index.html index.htm index.php;
	}

	location = /favicon.ico {
	   log_not_found off;
	   access_log off;
	}
	 location ~ \.php$ {
		fastcgi_pass   127.0.0.1:9000;
		fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
		include        fastcgi_params;
	}
}

apache.conf

<VirtualHost *:80>

    # Host that will serve this project.
    ServerName      app.dev

    # The location of our projects public directory.
    DocumentRoot    /path/to/our/public

    # Useful logs for debug.
    CustomLog       /path/to/access.log common
    ErrorLog        /path/to/error.log

    # Rewrites for pretty URLs, better not to rely on .htaccess.
    <Directory /path/to/our/public>
        <IfModule mod_rewrite.c>
            Options -MultiViews
            RewriteEngine On
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^ index.php [L]
        </IfModule>
    </Directory>

</VirtualHost>

nginx.conf

server {

    # Port that the web server will listen on.
    listen          80;

    # Host that will serve this project.
    server_name     app.dev;

    # Useful logs for debug.
    access_log      /path/to/access.log;
    error_log       /path/to/error.log;
    rewrite_log     on;

    # The location of our projects public directory.
    root            /path/to/our/public;

    # Point index to the Laravel front controller.
    index           index.php;

    location / {

        # URLs to attempt, including pretty ones.
        try_files   $uri $uri/ /index.php?$query_string;

    }

    # Remove trailing slash to please routing system.
    if (!-d $request_filename) {
        rewrite     ^/(.+)/$ /$1 permanent;
    }

    # PHP FPM configuration.
    location ~* \.php$ {
            fastcgi_pass                    unix:/var/run/php5-fpm.sock;
            fastcgi_index                   index.php;
            fastcgi_split_path_info         ^(.+\.php)(.*)$;
            include                         /etc/nginx/fastcgi_params;
            fastcgi_param                   SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    # We don't need .ht files with nginx.
    location ~ /\.ht {
            deny all;
    }
    
    # Set header expirations on per-project basis
    location ~* \.(?:ico|css|js|jpe?g|JPG|png|svg|woff)$ {
            expires 365d;

    }
}

lighttpd.conf

$HTTP["host"] =~ "example.com$" {
        server.document-root = "/path/to/our/public/"
        accesslog.filename = "/path/to/access.log"

        alias.url = ()
        url.redirect = ()
        url.rewrite-once = (
                "^/(css|img|js|fonts)/.*\.(jpg|jpeg|gif|png|swf|avi|mpg|mpeg|mp3|flv|ico|css|js|woff|ttf)$" => "$0",
                "^/(favicon\.ico|robots\.txt|sitemap\.xml)$" => "$0",
                "^/[^\?]*(\?.*)?$" => "index.php/$1"
        )
}

参考

laravel-website-configs

链接帖子
意见的链接
分享到其他网站

黑客攻防讨论组

黑客攻防讨论组

    You don't have permission to chat.
    • 最近浏览   0位会员

      • 没有会员查看此页面。
    ×
    ×
    • 创建新的...