Jump to content

julienmarie

Members
  • Posts

    12
  • Joined

  • Last visited

Posts posted by julienmarie

  1. Weirdly, I've added that in index.php :

    if (isset($_GET['it'])) {
      $_GET['it'] = str_replace($rootURL, "/", $_GET['it']);
    }
    

    on line 68 and now it works

    in my nginx file I just added : 

    location /mysite/ {
      try_files $uri $uri/ /mysite/index.php?it=$uri&$args;
    }
    

    Is this a bug ?

  2. Hi,

    How to adapt it to make it run with subdirectory installs ?

    Hey all,

    I've converted the ProcessWire 2.3 rules to Nginx. Hope this will help some people :)

    Greetings,

    Niek

    server {
    	listen 80;
    	listen 443 ssl;
    
    	root /var/www/example.com/public_html;
    	server_name example.com www.example.com;
    	ssl_certificate /etc/pki/tls/certs/example.com.crt;
    	ssl_certificate_key /etc/pki/tls/private/example.com.key;
    
    	client_max_body_size 50m;
    	access_log /var/www/example.com/_logs/access.log;
    	error_log /var/www/example.com/_logs/error.log;
    
    	# -----------------------------------------------------------------------------------------------
    	# Set default directory index files
    	# -----------------------------------------------------------------------------------------------
    
    	index index.php index.html index.htm;
    
    	# -----------------------------------------------------------------------------------------------
    	# Optional: Redirect users to the 'www.' version of the site (uncomment to enable).
    	# For example: http://processwire.com/ would be redirected to http://www.processwire.com/
    	# -----------------------------------------------------------------------------------------------
    
    	if ($host !~* ^www\.) {
    		rewrite ^(.*)$ $scheme://www.$host$1 permanent;
    	}
    
    	# -----------------------------------------------------------------------------------------------
    	# Access Restrictions: Protect ProcessWire system files
    	# -----------------------------------------------------------------------------------------------
    
    	# Block access to ProcessWire system files
    	location ~ \.(inc|info|module|sh|sql)$ {
    		deny all;
    	}
    
    	# Block access to any file or directory that begins with a period
    	location ~ /\. {
    		deny all;
    	}
    
    	# Block access to protected assets directories
    	location ~ ^/(site|site-[^/]+)/assets/(cache|logs|backups|sessions|config|install|tmp)($|/.*$) {
    		deny all;
    	}
    
    	# Block acceess to the /site/install/ directory
    	location ~ ^/(site|site-[^/]+)/install($|/.*$) {
    		deny all;
    	}
    
    	# Block dirs in /site/assets/ dirs that start with a hyphen
    	location ~ ^/(site|site-[^/]+)/assets.*/-.+/.* {
    		deny all;
    	}
    
    	# Block access to /wire/config.php, /site/config.php, /site/config-dev.php, and /wire/index.config.php
    	location ~ ^/(wire|site|site-[^/]+)/(config|index\.config|config-dev)\.php$ {
    		deny all;
    	}
    
    	# Block access to any PHP-based files in /templates-admin/
    	location ~ ^/(wire|site|site-[^/]+)/templates-admin($|/|/.*\.(php|html?|tpl|inc))$ {
    		deny all;
    	}
    
    	# Block access to any PHP or markup files in /site/templates/
    	location ~ ^/(site|site-[^/]+)/templates($|/|/.*\.(php|html?|tpl|inc))$ {
    		deny all;
    	}
    
    	# Block access to any PHP files in /site/assets/
    	location ~ ^/(site|site-[^/]+)/assets($|/|/.*\.php)$ {
    		deny all;
    	}
    
    	# Block access to any PHP files in core or core module directories
    	location ~ ^/wire/(core|modules)/.*\.(php|inc|tpl|module)$ {
    		deny all;
    	}
    
    	# Block access to any PHP files in /site/modules/
    	location ~ ^/(site|site-[^/]+)/modules/.*\.(php|inc|tpl|module)$ {
    		deny all;
    	}
    
    	# Block access to any software identifying txt files
    	location ~ ^/(COPYRIGHT|INSTALL|README|htaccess)\.(txt|md)$ {
    		deny all;
    	}
    
    	# Block all http access to the default/uninstalled site-default directory
    	location ~ ^/site-default/ {
    		deny all;
    	}
    
    	# -----------------------------------------------------------------------------------------------
    	# If the request is for a static file, then set expires header and disable logging.
    	# Give control to ProcessWire if the requested file or directory is non-existing.
    	# -----------------------------------------------------------------------------------------------
    
    	location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|eot|woff|ttf)$ {
    		expires 24h;
    		log_not_found off;
    		access_log off;
    		try_files $uri $uri/ /index.php?it=$uri&$args;
    	}
    
    	# -----------------------------------------------------------------------------------------------
    	# This location processes all other requests. If the request is for a file or directory that
    	# physically exists on the server, then load the file. Else give control to ProcessWire.
    	# -----------------------------------------------------------------------------------------------
    
    	location / {
    		try_files $uri $uri/ /index.php?it=$uri&$args;
    	}
    
    	# -----------------------------------------------------------------------------------------------
    	# Pass .php requests to fastcgi socket
    	# -----------------------------------------------------------------------------------------------
    
    	location ~ \.php$ {
    
    		# Check if the requested PHP file actually exists for security
    		try_files $uri =404;
    
    		# Fix for server variables that behave differently under nginx/php-fpm than typically expected
    		fastcgi_split_path_info ^(.+\.php)(/.+)$;
    
    		# Set environment variables
    		include fastcgi_params;
    		fastcgi_param PATH_INFO $fastcgi_path_info;
    		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    
    		# Pass request to php-fpm fastcgi socket
    		fastcgi_pass unix:/var/run/example.com_fpm.sock;
    	}
    }
    
  3. Hello,

    I'm deployed multiple pw sites already, all with nginx.

    This time I need to have multiple pw sites for a domain, every one of them under a subdirectory.

    I've been trying many things, every time I get 404 or 500 errors on /directory/processwire ( the /directory/ works, other pages not ).

    Did someone already managed to get that working ?

    PS : Apache is not an option :)

  4. Thanks Marty for the answer.

    I guess i just need to find the right hooks for file writing if they do exist then the rest will be doable. I have the time to make it. Of course I'll share it with the community ( I got a few other modules under dev that I will share along the summer ).

    J.

    • Like 1
  5. Hi,

    I'd like to create a module to upload directly every file ( images uploaded, css and js minified by AIOM, etc... ) to S3 so it can then be distributed via Cloudfront in a clean way.

    How would you proceed to detect these file creation/changes ?

    Thanks !

    J.

  6. could you kindly share your secrets with us? have you been working 24 hours/day?

    Hi totoff,

    I guess it's not really a secret. I used to run a webagency and I'm used to crazy deadlines.

    So, no i was not working 24/24 at all. I dont know if this method would work for everybody, but here is how I work :

    - Give yourself a deadline

    - Spend 1/8 of the time allocated to plan ahead the project, the data structure, the features.

    - Use tools, libraries, frameworks you know by heart, and learn one new tool ( no more no less ) at each project. Small tool for a small project, bigger tool for bigger project.

    - If you run into a bug, give yourself 10min and/or 5 tries max to find the reason of the bug (the reason, not the solution). If not found, don't get stuck, wait the next day.

    - Don't optimize before going to prod. Wait 24h after going to prod to see bottlenecks, then add one day to fix performance issues ( same thing : only tools you know, learn one new every time )

    - Use a good css/js library / framework.

    - Rely carefully on third party plugins : try to stay the master of your markup.

    - Work with repeatable design so your css will be repeatable and modularized.

    - Be the one who design the site : so you can balance difficulty

    - To do list, to do list. Plan the next day at the end of the day.

    - If you have the budget, use QA services ( like http://crowdsourcedtesting.com/ )

    - Know the market you're coding for. Don't kill yourself for under represented browsers.

    - Use a laptop, so you can code anywhere ( when you have an idea, etc... ).

    - Practice, practice, practice

    • Like 4
×
×
  • Create New...